Open desktop mechanic

pygtkconsole pygtk tutorial update

Thursday Aug 24, 2006

OpenSolaris Nevada build 46 contains GNOME 2.14.x, python and pyGTK. The pyGTK tutorial has an example of a program which lets you play with Gtk widgets from the python console. Unfortunately the example is based on an earlier version of pyGTK in GNOME 2.14, this should work:

>>> import pygtk
>>> import gtk
>>> w=gtk.Window()
>>> b=gtk.Button('Hello')
>>> w.add(b)
>>> def hello(b):
...     print "Hello, World!"
...
>>> b.connect('clicked',hello)
6
>>> w.show_all()
Python is pretty cool, but some of the bindings aren't necessarily write once, run everywhere yet.

Like this post? del.icio.us | furl | slashdot | technorati | digg
Comments:

Post a Comment:
Comments are closed for this entry.