FAQ Index - Search - Recent Changes - Everything - Add entry

<< Previous Entry | FAQ Entry 2.4 | Next Entry >>

2.4. If I installed PyGTK-0 and PyGTK-2 in parallel (using pygtk.pth) how do I indicate which one my script should use?

The new versions of PyGTK (see faq 2.1) provide a pygtk module in which you can call a method require() that allows you to request one version or the other:

 pygtk.require("1.2") # for pygtk-0
and

 pygtk.require("2.0") # for pygtk2
Note that you should do this before importing the gtk or gnome modules:

 # To require 2.0 
 import pygtk
 pygtk.require("2.0")
 import gtk, gtk.glade, gnome, gnome.ui
or:

 # To require 1.2
 import pygtk
 pygtk.require("1.2")
 import gtk, libglade, gnome, gnome.ui
If this simply doesn't work, please visit FAQ 2.6 for the nitty-gritty.

PyGTK FAQ Wizard | PyGTK Homepage | Feedback to faq at pygtk.org