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
  • Update README.rst: Correct link

    Update README.rst: Correct link

    Correct link for guide for first time contributors

    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 MarkusPiotrowski 0
  • 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
Releases(v0.3.0.dev39)
Owner
BeeWare
Write Python. Deploy everywhere.
BeeWare
QGUI - 0.1MB超轻量Python GUI框架,用模板来快捷制作深度学习模型推理界面

QGUI - 0.1MB超轻量Python GUI框架,用模板来快捷制作深度学习模型推理界面

QPT Family 92 Nov 18, 2022
Create highly interactive web pages purely in Python

A package for building highly interactive user interfaces in pure Python inspired by ReactJS.

701 Jan 03, 2023
Example GUI for Command line capable machine learning programs

Example GUI for Command line capable machine learning programs This is an example GUI made in PysimpleGUI and Tkinter, mainly for machine learning pro

Kim Yongwook 4 May 31, 2022
Basic calculator using Tkinter GUI

Basic calculator using Tkinter GUI

Rogerio Penchel 17 Jan 09, 2022
This repository contains some projects that I have done using Python + Tkinter.

This repository contains some projects that I have done using Python + Tkinter.

João Victor Vilela dos Santos 1 Nov 10, 2021
A simple todo GUI applicaiton

simple_todo_gui A simple todo GUI applicaiton To create an .exe file, run 'Python setup.py build' after installing PyQt5 and cx_Freeze with pip. Then

Dhammike Piyumal 2 Nov 11, 2021
Open source UI framework written in Python, running on Windows, Linux, macOS, Android and iOS

Kivy Innovative user interfaces made easy. Kivy is an open source, cross-platform Python framework for the development of applications that make use o

Kivy 15.4k Jan 07, 2023
AutoCalypsoBTS - A simple GUI CalypsoBTS for DragonOS by CrTh

AutoCalypsoBTS 📱 📞 A simple GUI CalypsoBTS for DragonOS by CrTh Download Drago

CrTx0 18 Dec 15, 2022
Python3.9/Kivy2.0 project to manage Valkyrie Scenarios

.valkyrie Manager This is a Python 3.9/Kivy 2.0 application that helps to manage quest (.valkyrie) files (from Valkyrie app) It identifies new quests

Kempes J. 1 Jan 28, 2022
Pyint is the graphic software which is written in Python

Pyint About Pyint Pyint is the graphic software which is written in Python(I use the Turtle graphics). The name 'Pyint' is compound word of 'Python' a

John 1 Nov 06, 2021
A python Script For Taking Screenshot Of Windows

PyShot A Python Script For Taking Screenshot Of Windows Disclaimer This tool is for educational purposes only ! Don't use this to take revenge I will

Nazim Cp 2 Jun 22, 2022
Projeto de mini-games de azar com interface gráfica utilizando Python e PySimpleGui.

Gambling Mini jogos de azar unidos em uma mesma interface gráfica, utilizando a linguagem de programação Python em conjunto com a biblioteca de interf

Clayton Garcia da Silva 3 Nov 19, 2021
GUI Python Auto text bot.

Bagel Text Bot Auto text bot. Written in Python. Contributing Pull requests are welcome. For major changes, please open an issue first to discuss what

Toby 3 May 14, 2022
A simple yet powerful TUI framework for your Python (3.7+) applications

A simple yet powerful TUI framework for your Python (3.7+) applications

1.4k Jan 04, 2023
A really minimalistic operating system made using python's GUI module Tkinter.

BoxOS V1.0.0 About A really minimalistic operating system made using python's GUI module Tkinter. What seperates it from the other operating systems m

Fahim 2 Dec 08, 2022
Input an antlr grammar and file for python to test it out

py-antlr-input Input an ANTLR grammar and test file for python to render a parser tree of the file. This program will make use of the grun command tha

Oscar Juárez 0 Aug 10, 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 quick GUI script to pseudo-anonymize patient videos for use in the GRK

grk_patient_sorter A quick GUI script to pseudo-anonymize patient videos for use in the GRK. Source directory — the highest level folder that will be

Peter Somers 1 Dec 09, 2021
Introduce QML-like declarative structure to Python world. Developer writes only pure Python code for QML.

Introduce QML-like declarative structure to Python world. Developer writes only pure Python code for QML.

likianta 4 Mar 27, 2022
Gmail account using brute force attack

Programmed in Python | PySimpleGUI Gmail Hack Python script with PySimpleGUI for hack gmail account using brute force attack If you like it give it

Adrijan 127 Dec 30, 2022