static-sites/bases/do-blog/resources/documents/python/gtk3/tut01/tut01-windows.py

25 lines
761 B
Python
Executable File

#!/usr/bin/python
from gi.repository import Gtk
class application_gui:
"""Tutorial 01 Create and destroy a window"""
def __init__(self):
#load in our glade interface
xml = Gtk.Builder()
xml.add_from_file('tut01.glade')
#grab our widget using get_object this is the name of the widget from glade, window1 is the default name
self.window = xml.get_object('window1')
#connect to events, in this instance just quit our application
self.window.connect('delete_event', Gtk.main_quit)
self.window.connect('destroy', lambda quit: Gtk.main_quit())
#show the window else there is nothing to see :)
self.window.show()
application = application_gui()
Gtk.main()