Getting Started
File:simple_example.py
#!/usr/bin/python
from gi.repository import Gtk
win = Gtk.Window()
win.connect("delete-event", Gtk.main_quit)
win.show_all()
Gtk.main()
Let me explain:
(1) from gi.repository import Gtk
To import Gtk class from gi.repository
(2) win = Gtk.Window()
To create a empty windows object.
(3) win.connect("delete-event", Gtk.main_quit)
To connect the window's delete event.
(4) win.show_all()
we display the window
Gtk.main()
we start the GTK+ processing loop which we quit when the window is closed (see line 5).