



PyGObject is a Python package which provides bindings for GObject based libraries such as GTK, GStreamer, WebKitGTK, GLib, GIO and many more.

It supports Linux, Windows and macOS and works with Python 3.6+ and PyPy3. PyGObject, including this documentation, is licensed under the LGPLv2.1+.

If you want to write a Python application for GNOME or a Python GUI application using GTK, then PyGObject is the way to go. For more information on specific libraries check out the “Python GTK 3 Tutorial” and the “Python GI API Reference”.

import gi gi . require_version ( "Gtk" , "3.0" ) from gi.repository import Gtk window = Gtk . Window ( title = "Hello World" ) window . show () window . connect ( "destroy" , Gtk . main_quit ) Gtk . main ()

How does it work?¶ PyGObject uses glib, gobject, girepository, libffi and other libraries to access the C library (libgtk-3.so) in combination with the additional metadata from the accompanying typelib file (Gtk-3.0.typelib) and dynamically provides a Python interface based on that information.