官方tutorial http://www.pygtk.org/pygtk2tutorial/
#!/usr/bin/env python
# example base.py
import pygtk
pygtk.require('2.0') #指定要使用的PyGTK版本,如果系统装了不止一个时会有用
import gtk
class Base:
def __init__(self):
self.window = gtk.Window(gtk.WINDOW_TOPLEVEL)
self.window.show()
def main(self):
gtk.main() #start the GTK+ event processing loop
print __name__
if __name__ == "__main__":
base = Base()
base.main() #has no way of exiting except to be killed by using the shell.