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 *



You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

  • Recent Posts

  • Picks

  • Boxing Clock for AndroidOcton8 Diving T-ShirtsShaking Tower Panda Android GameLearn Chinese with Android
  • Student projects