在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 widget
button = gtk.Button("Hello World")
button.connect("clicked", hello_cb) # call hello_cb when clicked
window.add(button) # add button to window
button.show() # show button
window.show()
gtk.main()