
Posted by admin on December 7, 2010
Installing PyGTK can be frustrating if you have the wrong file set or downloaded from yet another incomplete source. This is a quick install guide, an easy walk through with the links to install PyGTK into Python25 complete with the Glade Editor.
First, download and install Python25 from http://www.python.org/ftp/python/2.5/python-2.5.msi

Install Python25 to "c:\python25\" for all users

Use default settings and click next
Now install the file Glade3-3.6.7-with-GTK+ from http://ftp.gnome.org/pub/GNOME/binaries/win32/glade3/3.6/glade3-3.6.7-with-GTK+.exe This will add the Glade-3.6.6 editor into your programs list.

This installs to a different folder location
Now Download and install PyCairo, PyGobject and PyGTK

All versions should install for python25 and install into the 'site-packages' folder
Last but not least you need to add a path for 'python25.exe' in the environment editor. Click on 'Start', 'Control Panel', 'System' and then on the 'Advanced' tab.

Now click on the 'Enviroment Variables'

Click on the 'Path' in 'System Variables' and click edit
add ;c:\python25 to the end of the line and then okay.
Now you are ready to reboot and test the installation.The path that you added will not be reconized by XP until you reboot. After you have rebooted click 'Start', 'Accessories' and then 'Command Prompt'.If you type in 'python' and all has gone well and the path is correct you should be greeted with the python startup message.

Okay now test your imports for pygtk as shown below. The last check is 'sys.path', this prints the path python uses to search for files.
- >>> import gtk
- >>> import gobject
- >>> import pygtk
- >>> import gtk.glade
- >>>
- >>> import sys
- >>> sys.path
- ['', 'C:\\WINDOWS\\system32\\python25.zip', 'C:\\Python25\\DLLs', 'C:\\Python25\
- \lib', 'C:\\Python25\\lib\\plat-win', 'C:\\Python25\\lib\\lib-tk', 'C:\\Python25
- ', 'C:\\Python25\\lib\\site-packages', 'C:\\Python25\\lib\\site-packages\\gtk-2.
- 0']
- >>>
Note the windows use of '\' is displayed as a '\\'. This is not a ytpe, the convention for python in it's native envroment is '/' and the '\\' helps with this confusion.
Here are some extras that my interest you to add you your python setup...
| © 2012 Man-Machine. | Powered by concrete5 | Sign In to Edit this Site |