Open a terminal and enter your virtual environmentĮxecute sudo apt install libgirepository1.0-dev gcc libcairo2-dev pkg-config python3-dev gir1.2-gtk-4.0 Ubuntu / Debian Installing the system provided PyGObject:Įxecute sudo apt install python3-gi python3-gi-cairo gir1.2-gtk-4.0Ĭhange the directory to where your hello.py script can be found (e.g. In the mingw32 terminal execute python3 hello.py - a window should appear. To test that GTK is working you can run gtk4-demoĬopy the hello.py script you created to C:\msys64\home\ Run C:\msys64\mingw64.exe - a terminal window should pop upĮxecute pacman -S mingw-w64-x86_64-gtk4 mingw-w64-x86_64-python3 mingw-w64-x86_64-python3-gobject Windows įollow the instructions on the page for setting up the basic environment There are also typing stubs available here PyGObject-stubs. On how to create GTK apps and the “ PyGObject API Reference” for API documentation for all supported Follow the instructions for your platform below.Īfter running the example application have a look at the “ Python GTK 3 exit ( exit_status )īefore we can run the example application we need to install PyGObject, GTKĪnd their dependencies. present () app = MyApplication () exit_status = app. ![]() ![]() ApplicationWindow ( application = self, title = "Hello World" ) window. set_application_name ( 'My Gtk Application' ) def do_activate ( self ): window = Gtk. Application ): def _init_ ( self ): super (). require_version ( "Gtk", "4.0" ) from gi.repository import GLib, Gtk class MyApplication ( Gtk.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |