A Python native, OS native GUI toolkit.

Related tags

GUI Developmenttoga
Overview
https://beeware.org/project/projects/libraries/toga/toga.png

Toga

Python Versions Project version Project status License Build Status Codecov Gitter chat room

A Python native, OS native GUI toolkit.

Prerequisites

Minimum requirements

  • Toga requires Python 3. Python 2 is not supported.
  • If you're on macOS, you need to be on 10.10 (Yosemite) or newer.
  • If you're on Linux, you need to have GTK+ 3.10 or later. This is the version that ships starting with Ubuntu 14.04 and Fedora 20. You also need to install the Python 3 bindings and development files for GTK+.
    • Ubuntu 16.04 / Debian 9 sudo apt-get install python3-dev python3-gi python3-gi-cairo libgirepository1.0-dev libcairo2-dev libwebkitgtk-3.0-0 gir1.2-webkit2-3.0
    • Ubuntu 18.04 / Debian 10 sudo apt-get install python3-dev python3-gi python3-gi-cairo libgirepository1.0-dev libcairo2-dev libwebkitgtk-4.0-37 gir1.2-webkit2-4.0
    • Fedora sudo dnf install pygobject3 python3-gobject python3-cairo-devel cairo-gobject-devel gobject-introspection-devel pywebkitgtk
    • Arch / Manjaro sudo pacman -Syu git pkgconf cairo python-cairo pango gobject-introspection gobject-introspection-runtime python-gobject webkit2gtk
  • We're working on Windows support, but not all features and widgets are supported. At a minimum, you'll need Python 3 and .NET Framework 4. This has been tested on Windows 10, but should work on 7 and 8. Pull requests, help and corrections are most welcome.

Quickstart

To get a demonstration of the capabilities of Toga, run the following:

$ pip install --pre toga-demo
$ toga-demo

This will pop up a GUI window with some sample widgets.

Documentation

Documentation for Toga can be found on Read The Docs.

Community

Toga is part of the BeeWare suite. You can talk to the community through:

Contributing

If you'd like to contribute to Toga development, our guide for first time contributors will help you get started.

If you experience problems with Toga, log them on GitHub. If you want to contribute code, please fork the code and submit a pull request.

Comments
  • Add initial Qt backend implementation

    Add initial Qt backend implementation

    Basics only. Qt import included in lib folder. this is a startup for all developers. work in progress

    PR Checklist:

    • [x] All new features have been tested
    • [ ] All new features have been documented
    • [x] I have read the CONTRIBUTING.md file
    • [x] I will abide by the code of conduct
    opened by Ksengine 43
  • Convert Canvas Widget to Use a Drawing Stack

    Convert Canvas Widget to Use a Drawing Stack

    In #319 we discussed that it was desired to remove the callbacks created by using an on_draw handler, and instead push drawing commands to a stack to be drawn with.

    PR Checklist:

    • [X] All new features have been tested
    • [X] All new features have been documented
    • [X] I have read the CONTRIBUTING.md file
    • [X] I will abide by the code of conduct

    Current status: fully implemented

    • [X] Fix tests
    • [X] Further testing with other contexts besides the default one
    opened by danyeaw 36
  • Add `dummy` as a known platform, and use it in tests

    Add `dummy` as a known platform, and use it in tests

    Signed-off-by: Bruno Rino [email protected]

    When creating a widget in a TestCase, the factory always needs to be specified, as in:

            self.switch = toga.Switch(self.text,
                                      on_change=self.on_change,
                                      value=self.value,
                                      enabled=self.enabled,
                                      factory=toga_dummy.factory)
    

    My suggestion is to add dummy to the list of know platforms, and manually set the platform in the TestCase subclass. This would avoid the repetitive factory=toga_dummy.factory.

    I tested this against a single widget, and the test passed as intended.

    PR Checklist:

    • [ ] All new features have been tested
    • [ ] All new features have been documented
    • [x] I have read the CONTRIBUTING.md file
    • [x] I will abide by the code of conduct
    opened by bruno-rino 26
  • "TypeError: 'ObjCInstance' object is not callable" on macOS High Sierra

    In High Sierra (macOS 10.13), I am unable to use Toga or Toga-demo due to a TypeError. I was able to duplicate this on a fresh install of High Sierra in a VM; when I installed Toga and Toga-demo on a fresh install of Sierra (10.12), Toga and Toga-demo worked with no issues.

    This has similar symptoms as issue https://github.com/pybee/toga/issues/154, but downgrading Rubicon has not solved the problem.

    Details

    Python Installation

    $ uname -a
    Darwin Andrews-Mac.local 17.0.0 Darwin Kernel Version 17.0.0: Thu Aug 24 21:48:19 PDT 2017; root:xnu-4570.1.46~2/RELEASE_X86_64 x86_64
    $
    $ gcc --version
    Configured with: --prefix=/Library/Developer/CommandLineTools/usr --with-gxx-include-dir=/usr/include/c++/4.2.1
    Apple LLVM version 9.0.0 (clang-900.0.37)
    Target: x86_64-apple-darwin17.0.0
    Thread model: posix
    InstalledDir: /Library/Developer/CommandLineTools/usr/bin
    $
    $ CFLAGS="-I$(brew --prefix openssl)/include -O3" \
    LDFLAGS="-L$(brew --prefix openssl)/lib" \
    env PYTHON_CONFIGURE_OPTS="--enable-framework" pyenv install -v 3.6.3
    ...
    Installed Python-3.6.3 to /Users/ame/.pyenv/versions/3.6.3
    $ 
    $ pyenv shell 3.6.3
    $
    $ python -V -V
    Python 3.6.3 (default, Oct  9 2017, 17:43:29) 
    [GCC 4.2.1 Compatible Apple LLVM 9.0.0 (clang-900.0.37)]
    

    Virtualenv

    $ python -m venv .venv
    $
    $ source .venv/bin/activate
    $
    $ pip install toga toga-demo
    Collecting toga
      Downloading toga-0.2.15-py3-none-any.whl
    Collecting toga-demo
      Downloading toga_demo-0.2.15-py3-none-any.whl
    Collecting toga-cocoa; sys_platform == "darwin" (from toga)
      Downloading toga_cocoa-0.2.15-py3-none-any.whl
    Collecting toga-core>=0.2.15 (from toga-cocoa; sys_platform == "darwin"->toga)
      Downloading toga_core-0.2.15-py3-none-any.whl (413kB)
        100% |████████████████████████████████| 419kB 2.6MB/s 
    Collecting rubicon-objc>=0.2.8 (from toga-cocoa; sys_platform == "darwin"->toga)
      Downloading rubicon_objc-0.2.8-py3-none-any.whl
    Collecting colosseum>=0.1.6 (from toga-core>=0.2.15->toga-cocoa; sys_platform == "darwin"->toga)
      Downloading colosseum-0.1.6-py3-none-any.whl
    Installing collected packages: colosseum, toga-core, rubicon-objc, toga-cocoa, toga, toga-demo
    Successfully installed colosseum-0.1.6 rubicon-objc-0.2.8 toga-0.2.15 toga-cocoa-0.2.15 toga-core-0.2.15 toga-demo-0.2.15
    

    First Attempt

    $ toga-demo
    Traceback (most recent call last):
      File "/Users/ame/workspace/org.elgert/toga/.venv/bin/toga-demo", line 11, in <module>
        sys.exit(run())
      File "/Users/ame/workspace/org.elgert/toga/.venv/lib/python3.6/site-packages/toga_demo/__main__.py", line 5, in run
        main().main_loop()
      File "/Users/ame/workspace/org.elgert/toga/.venv/lib/python3.6/site-packages/toga_cocoa/app.py", line 167, in main_loop
        self._startup()
      File "/Users/ame/workspace/org.elgert/toga/.venv/lib/python3.6/site-packages/toga_cocoa/app.py", line 95, in _startup
        self._impl = NSApplication.sharedApplication()
    TypeError: 'ObjCInstance' object is not callable
    $ 
    $ python
    Python 3.6.3 (default, Oct  9 2017, 17:43:29) 
    [GCC 4.2.1 Compatible Apple LLVM 9.0.0 (clang-900.0.37)] on darwin
    Type "help", "copyright", "credits" or "license" for more information.
    >>> from rubicon.objc import *                        
    >>> NSBundle = ObjCClass('NSBundle')           
    >>> NSBundle.mainBundle()
    Traceback (most recent call last):
      File "<stdin>", line 1, in <module>
    TypeError: 'ObjCInstance' object is not callable
    >>> exit()
    

    Downgrade Rubicon

    Rubicon-objc==0.2.7

    $ pip install rubicon-objc==0.2.7
    Collecting rubicon-objc==0.2.7
      Downloading rubicon_objc-0.2.7-py3-none-any.whl
    Installing collected packages: rubicon-objc
      Found existing installation: rubicon-objc 0.2.8
        Uninstalling rubicon-objc-0.2.8:
          Successfully uninstalled rubicon-objc-0.2.8
    Successfully installed rubicon-objc-0.2.7
    $
    $ toga-demo
    Traceback (most recent call last):
      File "/Users/ame/workspace/org.elgert/toga/.venv/bin/toga-demo", line 11, in <module>
        sys.exit(run())
      File "/Users/ame/workspace/org.elgert/toga/.venv/lib/python3.6/site-packages/toga_demo/__main__.py", line 5, in run
        main().main_loop()
      File "/Users/ame/workspace/org.elgert/toga/.venv/lib/python3.6/site-packages/toga_cocoa/app.py", line 167, in main_loop
        self._startup()
      File "/Users/ame/workspace/org.elgert/toga/.venv/lib/python3.6/site-packages/toga_cocoa/app.py", line 95, in _startup
        self._impl = NSApplication.sharedApplication()
    TypeError: 'ObjCInstance' object is not callable
    

    Rubicon-objc==0.2.6

    $ pip install rubicon-objc==0.2.6
    Collecting rubicon-objc==0.2.6
      Downloading rubicon_objc-0.2.6-py3-none-any.whl
    Installing collected packages: rubicon-objc
      Found existing installation: rubicon-objc 0.2.7
        Uninstalling rubicon-objc-0.2.7:
          Successfully uninstalled rubicon-objc-0.2.7
    Successfully installed rubicon-objc-0.2.6
    $
    $ toga-demo
    Traceback (most recent call last):
      File "/Users/ame/workspace/org.elgert/toga/.venv/bin/toga-demo", line 7, in <module>
        from toga_demo.__main__ import run
      File "/Users/ame/workspace/org.elgert/toga/.venv/lib/python3.6/site-packages/toga_demo/__main__.py", line 2, in <module>
        from toga_demo.app import main
      File "/Users/ame/workspace/org.elgert/toga/.venv/lib/python3.6/site-packages/toga_demo/app.py", line 4, in <module>
        import toga
      File "/Users/ame/workspace/org.elgert/toga/.venv/lib/python3.6/site-packages/toga/__init__.py", line 114, in <module>
        set_platform()
      File "/Users/ame/workspace/org.elgert/toga/.venv/lib/python3.6/site-packages/toga/__init__.py", line 86, in set_platform
        local_vars['platform'] = importlib.import_module(module_name)
      File "/Users/ame/.pyenv/versions/3.6.3/Python.framework/Versions/3.6/lib/python3.6/importlib/__init__.py", line 126, in import_module
        return _bootstrap._gcd_import(name[level:], package, level)
      File "/Users/ame/workspace/org.elgert/toga/.venv/lib/python3.6/site-packages/toga_cocoa/__init__.py", line 2, in <module>
        from .app import *
      File "/Users/ame/workspace/org.elgert/toga/.venv/lib/python3.6/site-packages/toga_cocoa/app.py", line 8, in <module>
        from .command import Command, Group
      File "/Users/ame/workspace/org.elgert/toga/.venv/lib/python3.6/site-packages/toga_cocoa/command.py", line 3, in <module>
        from .widgets.icon import Icon
      File "/Users/ame/workspace/org.elgert/toga/.venv/lib/python3.6/site-packages/toga_cocoa/widgets/icon.py", line 4, in <module>
        from ..libs import NSImage
      File "/Users/ame/workspace/org.elgert/toga/.venv/lib/python3.6/site-packages/toga_cocoa/libs/__init__.py", line 1, in <module>
        from .appkit import *
      File "/Users/ame/workspace/org.elgert/toga/.venv/lib/python3.6/site-packages/toga_cocoa/libs/appkit.py", line 232, in <module>
        NSColor.declare_class_property('alternateSelectedControlColor')
      File "/Users/ame/workspace/org.elgert/toga/.venv/lib/python3.6/site-packages/rubicon/objc/objc.py", line 1300, in __getattr__
        raise AttributeError('%s.%s %s has no attribute %s' % (type(self).__module__, type(self).__qualname__, self.objc_class.name, name))
    AttributeError: rubicon.objc.objc.ObjCClass NSColor has no attribute declare_class_property
    

    Rubicon-objc==0.2.4

    $ pip install rubicon-objc==0.2.4
    Collecting rubicon-objc==0.2.4
      Downloading rubicon_objc-0.2.4-py3-none-any.whl
    Installing collected packages: rubicon-objc
      Found existing installation: rubicon-objc 0.2.6
        Uninstalling rubicon-objc-0.2.6:
          Successfully uninstalled rubicon-objc-0.2.6
    Successfully installed rubicon-objc-0.2.4
    $
    $ toga-demo
    Traceback (most recent call last):
      File "/Users/ame/workspace/org.elgert/toga/.venv/lib/python3.6/site-packages/rubicon/objc/objc.py", line 1274, in __getattr__
        return self.__dict__[name]
    KeyError: 'declare_class_property'
    
    During handling of the above exception, another exception occurred:
    
    Traceback (most recent call last):
      File "/Users/ame/workspace/org.elgert/toga/.venv/bin/toga-demo", line 7, in <module>
        from toga_demo.__main__ import run
      File "/Users/ame/workspace/org.elgert/toga/.venv/lib/python3.6/site-packages/toga_demo/__main__.py", line 2, in <module>
        from toga_demo.app import main
      File "/Users/ame/workspace/org.elgert/toga/.venv/lib/python3.6/site-packages/toga_demo/app.py", line 4, in <module>
        import toga
      File "/Users/ame/workspace/org.elgert/toga/.venv/lib/python3.6/site-packages/toga/__init__.py", line 114, in <module>
        set_platform()
      File "/Users/ame/workspace/org.elgert/toga/.venv/lib/python3.6/site-packages/toga/__init__.py", line 86, in set_platform
        local_vars['platform'] = importlib.import_module(module_name)
      File "/Users/ame/.pyenv/versions/3.6.3/Python.framework/Versions/3.6/lib/python3.6/importlib/__init__.py", line 126, in import_module
        return _bootstrap._gcd_import(name[level:], package, level)
      File "/Users/ame/workspace/org.elgert/toga/.venv/lib/python3.6/site-packages/toga_cocoa/__init__.py", line 2, in <module>
        from .app import *
      File "/Users/ame/workspace/org.elgert/toga/.venv/lib/python3.6/site-packages/toga_cocoa/app.py", line 8, in <module>
        from .command import Command, Group
      File "/Users/ame/workspace/org.elgert/toga/.venv/lib/python3.6/site-packages/toga_cocoa/command.py", line 3, in <module>
        from .widgets.icon import Icon
      File "/Users/ame/workspace/org.elgert/toga/.venv/lib/python3.6/site-packages/toga_cocoa/widgets/icon.py", line 4, in <module>
        from ..libs import NSImage
      File "/Users/ame/workspace/org.elgert/toga/.venv/lib/python3.6/site-packages/toga_cocoa/libs/__init__.py", line 1, in <module>
        from .appkit import *
      File "/Users/ame/workspace/org.elgert/toga/.venv/lib/python3.6/site-packages/toga_cocoa/libs/appkit.py", line 232, in <module>
        NSColor.declare_class_property('alternateSelectedControlColor')
      File "/Users/ame/workspace/org.elgert/toga/.venv/lib/python3.6/site-packages/rubicon/objc/objc.py", line 1277, in __getattr__
        raise AttributeError('ObjCClass %s has no attribute %s' % (self.name, name))
    AttributeError: ObjCClass NSColor has no attribute declare_class_property
    
    opened by elgertam 23
  • On Linux, window contents are rendered behind a menubar

    On Linux, window contents are rendered behind a menubar

    But only if the menubar wasn't defined in the application code. Here's a slightly modified example code I'm running:

    import toga
    
    def build(app):
        box = toga.Box()
        button = toga.Button('Hello world', on_press=lambda _: print("hello"))
        box.add(button)
        return box
    
    if __name__ == '__main__':
        app = toga.App('First App', 'org.pybee.sample', startup=build)
        app.main_loop()
    

    Here's how it looks like to me:

    image

    Note that the button is behind the menubar (although no menubar was requested in the code). When I click on the menubar (including the Application or Help menu items), the button is being pressed instead.

    I've tried this with a few GTK themes, including Arc-OSX-dark, Mint-X, Redmond and Adwaita, and in every case it behaves this way.

    bug up-for-grabs 
    opened by notpushkin 22
  • Issue running tutorials 1 - 4

    Issue running tutorials 1 - 4

    When I try running the tutorials from the master branch on Ubuntu I get the following error: from toga.style.pack import * ImportError: No module named 'toga.style'

    opened by MRFaria 21
  • New Feature: Get a reference to a widget by id

    New Feature: Get a reference to a widget by id

    It is perfectly valid Python to define either a full or partial GUI widget hierarchy in the following way.

        self.content = Box(
            style=Pack(flex=1, direction=COLUMN),
            children=[
                TextInput(
                    id='node_name_input',
                    placeholder='Enter topic name'
                ),
                Box(
                    style=Pack(flex=1),
                    children=[
                        Button(
                            'Ok',
                            on_press=self.on_accept
                        ),
                        Button(
                            'Cancel',
                            on_press=self.on_close
                        )
                    ]
                )
            ]
        )
    

    In this example I subsequently want to get the value of the TextInput box when the 'Ok' button is clicked but because of the way it has been declared I have no immediate reference to it. It would be useful to have a method in the base Window class that mimics the HTML DOM getElementById() that returns a reference to the widget given its 'id'.

    enhancement not-quite-right 
    opened by Bobw147 20
  • Icons

    Icons

    Moved the icons file resolution to the backend for cocoa and winforms.

    Now, backends can get their proprietary file format ('.icns' for cocoa and '.ico') or create icons from '.bmp' or '.png' files. (Although I didn't find a bmp icon file, so I only tested ico and png on winforms.) I also adjusted tests because now core/icon doesn't automatically add '.icns' to the icon filename.

    If this is acceptable, we will need to test and update other backends, too.

    There is an issue about lack of icons in windows in briefcase.

    PR Checklist:

    • [ ] All new features have been tested
    • [x] All new features have been documented
    • [x] I have read the CONTRIBUTING.md file
    • [x] I will abide by the code of conduct
    opened by obulat 20
  • Recommend to use pip to install pygobject

    Recommend to use pip to install pygobject

    Recently, pygobject can be installed from pip. So this PR recommends the user to install pygobject through pip.

    It also deletes redundant code that handles different operating systems which was sometimes found to be incorrect.

    Fixes https://github.com/pybee/toga/issues/371

    I am really not sure if I missed any sensitive branches that just needed to be there, I will need some help on that.

    PR Checklist:

    • [x] All new features have been tested
    • [x] All new features have been documented
    • [x] I have read the CONTRIBUTING.md file
    • [x] I will abide by the code of conduct
    opened by SanketDG 20
  • [WIP] Get tutorial 2 working with the winforms backend

    [WIP] Get tutorial 2 working with the winforms backend

    In order to learn some of the internals of toga I've been working at trying to get the winforms backend working for tutorial 2. This involves implementing some new components for the winforms backend:

    • SplitContainer (partially done)
    • Table (done)
    • Command (not started)
    opened by clokep 20
  • Fix bug when switching window content in winform

    Fix bug when switching window content in winform

    Bug Description

    In my application I'm using a single toga.Window and switch its content multiple times instead of opening new windows. In my main box box1 I have button that replace the content of the window with box2, and in box2 I have a "back" button that replace the content of the window back to box1.

    When I'm clicking the button that move from box1 to box2 everything is fine. When I try to got back to to box1 using the "back" button I get a RuntimeError that "Already have a container".

    This is a bug.

    How I fixed it

    When setting the container of a widget in windows, first if the widget already has a container, setting it to None and removing it from Controls. After that, if the new container is not None, setting it.

    This way we can remove boxes from the window and move them back freely.

    PR Checklist:

    • [X] All new features have been tested
    • [X] All new features have been documented
    • [X] I have read the CONTRIBUTING.md file
    • [X] I will abide by the code of conduct
    opened by saroad2 19
  • Inconsistent behaviour with toga.Selection value attribute between Windows and Android

    Inconsistent behaviour with toga.Selection value attribute between Windows and Android

    Describe the bug

    On Windows, when a selection widget is created with a list containing an empty string (eg: toga.Selection(items=['1','a','','4']) ), the widget returns '' for the "value" attribute.

    On Android, the selection's "value" attribute is set to None if the selection item is an empty string.

    I don't have MacOS, iOS, or Linux devices so I don't know what happens there.

    Steps to reproduce

    1. Create Beeware Project
    2. Go to the app.py file
    3. Create a list "list_1" containing an empty string
    4. Create the base app class with the startup function and setup main box + window
    5. In the startup function, create a selection with the items being that of list_1. Store it as a class attribute for future access.
    6. Define a class function that outputs the selection value via print or info_dialog.
    7. Create Button to call the output function
    8. Add Selector & Button to main box
    9. Compile the code for both Windows and Android & launch them.
    10. Select the empty item of the selector
    11. Press the button
    12. Watch as the devices disagree on the value.

    Expected behavior

    I would expect the selector value attribute to be an empty string as that was what the item was, and that is what the selector widget understands when values are written to it.

    Screenshots

    The source code I used:

    """
    Testing Crashes
    """
    import toga
    class TestLab(toga.App):
        def startup(self):
            main_box=toga.Box()
            self.select=toga.Selection(items=['A','B','0','','1','+','-'])
            main_box.add(self.select)
            main_box.add(toga.Button('Get',on_press=self.valuedump))
            self.main_window=toga.MainWindow(title=self.formal_name)
            self.main_window.content=main_box
            self.main_window.show()
        async def valuedump(self,widget):
            q=self.select.value
            print('GET',q,type(q))
            self.main_window.info_dialog('Selection Value',f'Value: "{q}"\n Type: {type(q)}')
    def main():return TestLab()
    

    On Windows:

    A_val sel_vals Null_val

    On Android:

    Screenshot_20221227-171610 Screenshot_20221227-171624 Screenshot_20221227-171635

    Environment

    Windows 8.1 / Android 11

    • Python version: 3.10.0
      • Briefcase: 3.11
      • Toga: 0.3.0.dev8

    Logs

    Windows: briefcase.2022_12_27-17_09_47.run.log

    Android: briefcase.2022_12_27-17_17_14.run.log

    Additional context

    No response

    bug android 
    opened by IneededAnAccountToDoStuff 1
  • Warnings when running Hello World script

    Warnings when running Hello World script

    Describe the bug

    (.venv) [email protected]:~/st/toga$  cd /home/paul/st/toga ; /usr/bin/env /home/paul/st/toga/.venv/bin/python /home/paul/.vscode/extensions/ms-python.python-2022.20.1/pythonFiles/lib/python/debugpy/adapter/../../debugpy/launcher 34737 -- /home/paul/st/toga/print.py 
    /home/paul/st/toga/.venv/lib/python3.11/site-packages/toga_gtk/app.py:65: DeprecationWarning: There is no current event loop
      self.loop = asyncio.get_event_loop_policy().get_event_loop()
    /home/paul/st/toga/.venv/lib/python3.11/site-packages/toga_gtk/app.py:40: DeprecationWarning: Gtk.Window.set_wmclass is deprecated
      self.native.set_wmclass(app.interface.name, app.interface.name)
    WARNING: Can't find icon resources/toga; falling back to default icon
    hello
    

    Steps to reproduce

    1. Install the prerequisites and Toga in venv.
    2. Run the script from https://toga.readthedocs.io/en/latest/tutorial/tutorial-0.html.
    3. Click on Help->About First App
    import toga
    
    
    def button_handler(widget):
        print("hello")
    
    
    def build(app):
        box = toga.Box()
    
        button = toga.Button("Hello world", on_press=button_handler)
        button.style.padding = 50
        button.style.flex = 1
        box.add(button)
    
        return box
    
    
    def main():
        return toga.App("First App", "org.beeware.helloworld", startup=build)
    
    
    if __name__ == "__main__":
        main().main_loop()
    

    Expected behavior

    No warnings?

    Screenshots

    No response

    Environment

    • Operating System: Ubuntu 22.04.1
    • Python version: 3.11.1
    • Software versions:
      • Briefcase:
      • Toga: 0.3.0.dev39
      • ...

    Logs

    
    

    Additional context

    No response

    bug first-timers-only linux 
    opened by pauljurczak 5
  • toga Sound

    toga Sound

    What is the problem or limitation you are having?

    I would like to make an app, which plays sound effects on button press the only solution i could find was this.

    Describe the solution you'd like

    a sound playing api, with support for mp3 or wav

    Describe alternatives you've considered

    https://stackoverflow.com/questions/74120614/how-to-play-sound-in-an-android-app-created-by-beeware-using-python

    Additional context

    No response

    enhancement 
    opened by coolcoder613eb 11
  • GTK: app segfaults if unable to connect to display

    GTK: app segfaults if unable to connect to display

    Describe the bug

    This appeared in #1687 when xvfb-run was missing from the Toga testbed CI command. I can also reproduce it locally.

    Steps to reproduce

    Unset the DISPLAY environment variable, then try to run the app:

    $ briefcase dev
    
    [testbed] Starting in dev mode...
    ===========================================================================
    Unable to init server: Could not connect: Connection refused
    Unable to init server: Could not connect: Connection refused
    
    (__main__.py:20685): Gtk-CRITICAL **: 08:59:26.455: _gtk_style_provider_private_get_settings: assertion 'GTK_IS_STYLE_PROVIDER_PRIVATE (provider)' failed
    
    (__main__.py:20685): Gtk-CRITICAL **: 08:59:26.460: _gtk_style_provider_private_get_settings: assertion 'GTK_IS_STYLE_PROVIDER_PRIVATE (provider)' failed
    
    (__main__.py:20685): Gtk-CRITICAL **: 08:59:26.460: _gtk_style_provider_private_get_settings: assertion 'GTK_IS_STYLE_PROVIDER_PRIVATE (provider)' failed
    Fatal Python error: Segmentation fault
    
    Current thread 0x00007ff9f3404740 (most recent call first):
      File "/home/smith/git/beeware/toga/gtk/src/toga_gtk/icons.py", line 14 in __init__
      File "/home/smith/git/beeware/toga/core/src/toga/icons.py", line 77 in __init__
      File "/home/smith/git/beeware/toga/core/src/toga/app.py", line 455 in icon
      File "/home/smith/git/beeware/toga/core/src/toga/app.py", line 330 in __init__
      File "/home/smith/git/beeware/toga/testbed/src/testbed/app.py", line 27 in main
      File "/home/smith/git/beeware/toga/testbed/src/testbed/__main__.py", line 4 in <module>
      File "/home/smith/.pyenv/versions/3.8.12/lib/python3.8/runpy.py", line 87 in _run_code
      File "/home/smith/.pyenv/versions/3.8.12/lib/python3.8/runpy.py", line 97 in _run_module_code
      File "/home/smith/.pyenv/versions/3.8.12/lib/python3.8/runpy.py", line 207 in run_module
      File "<string>", line 1 in <module>
    
    Problem running application 'testbed'
    

    AppImage is much worse because it doesn't give any hint of what the cause of the crash is:

    $ briefcase run
    
    [testbed] Starting app...
    ===========================================================================
    /tmp/.mount_Toga_TpKBh1e/AppRun.wrapped: line 11: 22376 Segmentation fault      "${APPDIR}/usr/bin/python3" -u -s -X utf8 -c "import runpy, sys; sys.path.pop(0); runpy.run_module('${BRIEFCASE_MAIN_MODULE}', run_name='__main__', alter_sys=True)" "$@"
    
    Problem running app testbed.
    

    Expected behavior

    When unable to connect to the display, both run and dev should give an actionable error message, not a segfault, and ideally not a Python traceback either.

    Screenshots

    No response

    Environment

    • Operating System: Debian 10
    • Python version: 3.8
    • Software versions:
      • Briefcase: 0.3.11
      • Toga: 0.3.0dev39

    Logs

    No response

    Additional context

    No response

    bug linux 
    opened by mhsmith 0
  • macOS: Toga windows don't support close or minimize commands

    macOS: Toga windows don't support close or minimize commands

    Describe the bug

    On macOS, Toga apps don't respond to Cmd-W for close or Cmd-M for minimize. They only respond to Cmd-Q for quit.

    I also notice the app doesn’t have a Window menu, which is where those commands would normally appear.

    Steps to reproduce

    • On macOS, run briefcase dev in any app.
    • When the window appears, press Cmd-W or Cmd-M.
    • Computer gives an error sound, and nothing happens.

    Expected behavior

    Toga should support all standard window management commands on each OS.

    Screenshots

    Screenshot 2022-12-13 at 09 32 28

    Environment

    • Operating System: macOS 12.6
    • Python version: 3.11
    • Software versions:
      • Briefcase: 0.3.11
      • Toga: 0.3.0dev39

    Logs

    No response

    Additional context

    No response

    bug macOS 
    opened by mhsmith 0
  • Simplify API for canvas event handlers

    Simplify API for canvas event handlers

    What is the problem or limitation you are having?

    The current implementation of event handlers on toga.Canvas has some interesting quirks.

    1. It allows for a "double click drag"... and I'm not even sure what that would mean.
    2. It is closely bound to a mouse-driven implementation (in particular, it references alt and double click)

    Describe the solution you'd like

    It might make more sense to drop the clicks argument to the event handlers, and have separate events for:

    • on_press and on_alt_press
    • on_activate (i.e., double click) and on_alt_activate
    • on_drag
    • on_release and on_alt_release

    That would make events a lot closer to their "functional" purpose, rather than tying them to a specific implementation (e.g. - what is a double click on a touchscreen?) It would de-emphasize the importance of clicks, especially in the context of drag; and it would put the focus on press/activate, rather than release events.

    The general advice would be to avoid using "alt" press (or, at least, provide different ways of accessing that functionality); this is consistent with the sort of approach taken by the macOS style guide, which allows for "right click" actions, but encourages that to be an interface for "power users".

    This would simplify the winforms and GTK implementations (which currently need to do imml-level stateful tracking of the current click state), and makes the API for mobile canvas less of a band-aid (as we can use long-press or force-press events for "activate").

    Describe alternatives you've considered

    Do nothing. The current API works; it's just not ideal.

    Additional context

    No response

    enhancement 
    opened by freakboy3742 0
Releases(v0.3.0.dev39)
Owner
BeeWare
Write Python. Deploy everywhere.
BeeWare
A GUI panel to manage multi monitor on i3wm.

Monitor manager Only for I3wm (Just for now) It's about two years that I'm using i3 as my window manager and in my experience this window manager allo

Wire.Nemo 3 Nov 06, 2021
Declarative User Interfaces for Python

Welcome to Enaml Enaml is a programming language and framework for creating professional-quality user interfaces with minimal effort. What you get A d

1.4k Jan 07, 2023
A Python Tkinter based Inventory managment System

Inventory Management System Using Python Tkinter Introduction Inventory managemrnt system is an open source platform for manage business. It has a com

Amit Kumar Datta 2 Oct 14, 2021
A small pomodoro GUI for Windows/Linux created in Python with PyQt5.

Pomodoro A small pomodoro GUI for Windows/Linux created with PyQt5. Features The "Timer" tab allows you to set your desired work and rest times aswell

Burak Martin 81 Dec 28, 2022
Basic browser based on PyQt5

goneDev-browser "basic browser based on PyQt5" This application is primarily built on macOS with more adaptibility for MacOS than Windows. v1.0 will s

Harsh ADV) 1 Jan 19, 2022
A Minimalistic Backup GUI for your Windows, Mac or Linux

BlobBackup is a minimalistic backup utility for your Windows, Mac or Linux computer. With an excellent engine, extensive storage support, and an easy

283 Nov 30, 2022
A keyboard-driven, vim-like browser based on PyQt5.

qutebrowser is a keyboard-focused browser with a minimal GUI. It’s based on Python and PyQt5 and free software, licensed under the GPL.

qutebrowser 8.4k Jan 01, 2023
This is a short GUI project to evaluate Pbk solution.

Polubarinova-Kochina-solutions (Standalone GUI executables for Windows and Mac) Oden Institute for Computational Engineering and Sciences / Jackson Sc

Mohammad Afzal Shadab 1 Dec 24, 2022
WhirlEdit, an excellent {code} editor

HELP! If you're experienced, I want you to make an executable for your platform (windows/mac/linux) and help me.. For more info get in touch at whirlp

whmsft 10 Aug 18, 2022
Transparent & click through tkinter window. WINDOWS ONLY

REQUIREMENTS: WINDOWS ONLY pip install pywin32 NOTES: Will not work on top of a fullscreen application, if you are using this to draw on top of a gam

francis 2 Nov 04, 2022
Pyabr lightweight OS with Python and Qt

Pyabr cloud computing software In the name of God, the Compassionate, the Merciful Pyabr © 2021 Mani Jamali. Free Software GNU General Public License

PyFarsi Software Foundation 88 Dec 26, 2022
Easily display all of your creative avatars to keep them consistent across websites.

PyAvatar Easily display all of your creative avatars to keep them consistent across websites. Key Features • Download • How To Use • Support • Contrib

William 2 Oct 02, 2022
Create custom desktop notificatons using python

Create custom desktop notificatons using python In this video i am going to use a module called plyer

Niranjan 2 Dec 15, 2021
python+PySimpleGUI+pyserial+threading

GUI_pyserial python+PySimpleGUI+pyserial+threading 功能 1.利用PySimpleGUI制作图形用户界面 2.利用threading实现多线程调用pyserial处理串口通信 模块版本 PySimpleGUI 4.46.0 pyserial 3.5

2 Dec 27, 2022
This was my test project when i started to learn Python Tkinter. Its the simplest interface possible.

Rock-Paper-Scissors-Game- Project Description: This was my test project when i started to learn Python Tkinter. Its the simplest interface possible. R

Hassan Shahzad 2 Jan 17, 2022
psgresizer - a PySimpleGUI application that will resize your images and BASE64 encode them.

psgresizer A PySimpleGUI Application Resize your images quickly and easily with this GUI application. Resizes and encodes to Base64 so that the result

PySimpleGUI 10 Dec 25, 2022
Make nixos usable for non-technical users through a settings / package management GUI.

Nix-Gui Make nixos usable for non-technical users through a settings / package management GUI. Motives The declarative nature of ni

547 Dec 31, 2022
Use CSS styling in Tkinter apps

cssTk To-Do Support Upto CSS 4.15 Set Up Docs Features * Corner Radius Gradient BG Blur Animations Usage Scenarios Allows easy import of GTK 3 and GTK

RUG 5 Oct 18, 2022
Firefox 96 Webapps for Gnome 3

mozapp Do you prefer Firefox to Chrome? Me too! But ever since Firefox dropped support for standalone web applications, I've resorted to using Chrome

Marten de Vries 8 Oct 31, 2022
Desktop application for Windows/macOS users to rotate through custom, preset, and searched-for collections of backgrounds with scheduling and additional settings

Background Revolution (In Development, Alpha Release) What? This will be an application for users to customize their windows backgrounds by uploading

Daniel Agapov 1 Nov 02, 2021