A Python native, OS native GUI toolkit.

Related tags

GUI Development toga
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) paul@desktop:~/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
A GUI for designing Python GUI's for PySimpleGUI.

SimpleGUIBuilder A GUI for designing Python GUI's for PySimpleGUI. Installation There is none :) just download the file from a release and run it. Don

Miguel Martins 65 Dec 22, 2022
PyQt5 Sample GUI Program - Python PyQt5 Sample GUI application

Python PyQt5 Sample GUI application Program work like this Designed GUI using De

Dimuth De Zoysa 5 Mar 27, 2022
The GUI application by Python3.8. Using QT Design draw UI and generator UI XML file provides to PySide2 build GUI components

The GUI application by Python3.8. Using QT Design draw UI and generator UI XML file provides to PySide2 build GUI components. Total adopt OOD design class, service, and abstract class. OOP implemented this project.

Jiage 1 Jan 11, 2022
Learn to build a Python Desktop GUI app using pywebview, Python, JavaScript, HTML, & CSS.

Python Desktop App Learn how to make a desktop GUI application using Python, JavaScript, HTML, & CSS all thanks to pywebview. pywebview is essentially

Coding For Entrepreneurs 55 Jan 5, 2023
A little Python library for making simple Electron-like HTML/JS GUI apps

Eel Eel is a little Python library for making simple Electron-like offline HTML/JS GUI apps, with full access to Python capabilities and libraries. Ee

Chris Knott 5.4k Jan 7, 2023
Turn (almost) any Python command line program into a full GUI application with one line

Gooey Turn (almost) any Python 2 or 3 Console Program into a GUI application with one line Support this project Table of Contents Gooey Table of conte

Chris 17k Jan 9, 2023
Build GUI for your Python program with JavaScript, HTML, and CSS

https://pywebview.flowrl.com pywebview is a lightweight cross-platform wrapper around a webview component that allows to display HTML content in its o

Roman 3.3k Jan 1, 2023
Edifice: a declarative GUI library for Python

Edifice is a Python library for building reactive UI, inspired by modern Javascript libraries such as React.

David Ding 193 Dec 11, 2022
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
My Git GUI version made in Python and Tkinter.

Description My Git GUI version made in Python and Tkinter. How to use Basically, create a folder in your computer, open the software, select the path

Matheus Golzio 4 Oct 10, 2021
Aplicação GUI feita em Python para estudos de cadastro (forms).

Cadastro de DEVs GUI ?? A ideia original veio do repositório do https://github.com/PedroTomazeti nomeado 'Projetos-Independentes-HTML-CSS' Nele há um

Yago Goltara 3 Aug 15, 2021
Delphi's FireMonkey framework as a Python module for Windows, MacOS, Linux, and Android GUI development.

DelphiFMX4Python Delphi's FireMonkey framework as a Python module for Windows, MacOS, Linux, and Android GUI development. About: The delphifmx library

Embarcadero Technologies 191 Jan 9, 2023
Simple GUI python app to show a stocks graph performance. Made with Matplotlib and Tiingo.

stock-graph-python Simple GUI python app to show a stocks graph performance. Made with Matplotlib and Tiingo. Tiingo API Key You will need to add your

Toby 12 May 14, 2022
A Url Shortener with GUI made in Python.

Url-Shortener-with-GUI-in-python A Url Shortener with GUI made in Python. To Run this download the zip file and run the main file or Clone this repo.

SidTheMiner 1 Nov 12, 2021
Create shortcuts on Windows to your Python, EXE, Batch files or any other file using a GUI made with PySimpleGUI

shor Windows Shortcut Creation Create Windows Shortcuts to your python programs and any other file easily using this application created using PySimpl

PySimpleGUI 7 Nov 16, 2021
Signin/Signup GUI form using tkinter in python

SignIn-SignUpFormRepo Hello there, I am Shahid and this is the Signin/Signup GUI form using tkinter in python if you want to use avatar images then pa

Shahid Akhtar 1 Nov 9, 2021
LittlePythonGUIGuide - This is a short GUI Guide with python

This is a short GUI Guide with python, learning how to use the simple and easy moduel built into python, named tkinter.

1cy50ng3b0b 1 Nov 21, 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