Overview
PyGObject provides Python bindings for GObject libraries, particularly GTK. It's the primary way to create GTK applications in Python and is especially popular in Linux environments.
Key features
- Native GTK widgets
- GObject integration
- Modern GTK features
- Linux desktop integration
- Extensive documentation
Common use cases
- Linux desktop applications
- GNOME applications
- System tools
- Development tools
- Configuration utilities
Installation
pip install PyGObject
Example
import gi
gi.require_version('Gtk', '4.0')
from gi.repository import Gtk
class MainWindow(Gtk.Window):
def __init__(self):
super().__init__(title="Hello PyGObject")
self.button = Gtk.Button(label="Hello, World!")
self.set_child(self.button)
app = Gtk.Application()
win = MainWindow()
win.show()