_images/pygobject.svg

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 2.7+ as well as Python 3.4+. 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?

_images/overview.svg

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.

Who Is Using PyGObject?

  • D-Feet - an easy to use D-Bus debugger
  • GNOME Music - a music player for GNOME
  • GNOME Tweak Tool - a tool to customize advanced GNOME 3 options
  • Gramps - a genealogy program
  • Lollypop - a modern music player
  • Meld - a visual diff and merge tool
  • MyPaint - a nimble, distraction-free, and easy tool for digital painters
  • Orca - a flexible and extensible screen reader
  • Pithos - a Pandora Radio client
  • Pitivi - a free and open source video editor
  • Quod Libet - a music library manager / player
  • Transmageddon - a video transcoder

The following applications or libraries use PyGObject for optional features, such as plugins or as optional backends:

  • beets - a music library manager and MusicBrainz tagger
  • gedit- a GNOME text editor
  • matplotlib - a python 2D plotting library
  • Totem - a video player for GNOME