DEV Community

MrRobot
MrRobot

Posted on

Toga – Native Python GUI Toolkit

Toga is a Python library for building native, cross-platform GUI applications. Unlike web-based frameworks, Toga renders native widgets on Windows, macOS, Linux, iOS, and Android, ensuring that apps look and feel like platform-native software. It is ideal for developers who want to write GUI applications in pure Python while maintaining a consistent interface across multiple platforms.


Installation:

pip install toga
Enter fullscreen mode Exit fullscreen mode

Example usage:

import toga 

def callback(widget):
    print("hello")

def my_app(app):
    box = toga.Box()

    btn = toga.Button(text='hi', on_press=callback)
    box.add(btn)

    return box 

app = toga.App('Example of Toga', 'org.example.hello', startup=my_app)
app.main_loop()
Enter fullscreen mode Exit fullscreen mode

PyPI page: https://pypi.org/project/toga/
GitHub page: https://github.com/beeware/toga


3 Project Ideas:

  1. Build a cross-platform desktop application for personal productivity.
  2. Develop a lightweight native GUI wrapper for Python scripts.
  3. Create a mobile and desktop version of a note-taking app with the same codebase.

Top comments (0)