pygtkconsole pygtk tutorial update

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.

Comments:

Post a Comment:
Comments are closed for this entry.
About

bnitz

Search

Archives
« April 2014
MonTueWedThuFriSatSun
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
    
       
Today