在Windows下的python2.3中安装 pyGTK,装的时候版本老是出问题,试了几次才实验成功,
python2.3.3
pygtk-2.2.0.win32-py2.3.exe(或pygtk-2.2.0-1.win32-py2.3.exe)
GTK-Runtime-Environment-2.2.4.exe(或GTK-Runtime-Environment-2.2.4.2.exe)
就安装上面的就可以,如果机器上还装有其他GTK的东西,
很难保证版本了,
GTK-Runtime-Environment-2.2.4.exe 安装好了后,
把C:\Program Files\Common Files\GTK\2.0\lib(具体安装路径)加到path中,
这个是它的动态连接库全在这里面。
pygtk-2.2.0.win32-py2.3.exe 这里有: http://www.pcpm.ucl.ac.be/~gusti n/win32_ports/binaries/pygtk-2.2.0.win32-py2.3.exe
pygtk-2.2.0-1.win32-py2.3.exe 这里有: http://www.pcpm.ucl.ac.be/~gus tin/win32_ports/binaries/pygtk-2.2.0-1.win32-py2.3.exe
GTK-Runtime-Environment-2.2.4.exe 这里有: http://www.org.lcs.mit.edu/6.893/files/GTK -Runtime-Environment-2.2.4.exe
在sourceforge.net上也是有的:http://sourceforge.net/projects/gtk-win/
工具推荐:glade2 http://gladewin32.sourceforge.net/
测试代码
code:
import gtkdef hello_cb(button):
print "Hello World"
window.destroy()window = gtk.Window(gtk.WINDOW_TOPLEVEL) # create a top level window
window.connect("destroy", gtk.mainquit) # quit the event loop on destruction
window.set_border_width(10) # set padding round child widgetbutton = gtk.Button("Hello World")
button.connect("clicked", hello_cb) # call hello_cb when clicked
window.add(button) # add button to window
button.show() # show buttonwindow.show()
gtk.main()