Windows and Buttons in Python – Ten Lines of PyGTK

It’s easy to write grahical user interface with python.
Write twindow to a text file, then run it.

$ nano
$ python twindow

Do you see a window? Does it print some text to command line when you click the button? Well done, you made your first graphical user interface program with Python.

import gtk
def thello(widget):
        print "Button was clicked."
w.connect("destroy", gtk.main_quit)
b=gtk.Button("Click me")
b.connect("clicked", thello)

Posted in Uncategorized | Tagged , , , , , , | Leave a comment

Leave a Reply

Your email address will not be published. Required fields are marked *