many programmers import both gtk and pygtk in this way:
import gtk
import pygtk
I have created a simple program using only gtk and it works:
import gtk
window = gtk.Window()
window.set_size_request(800, 700)
window.set_position(gtk.WIN_POS_CENTER)
window.connect("destroy", gtk.main_quit)
button = gtk.Button("Vai")
button.set_size_request(30, 35)
button.connect("clicked", naviga)
testo = gtk.Entry()
h = gtk.HBox()
h.pack_start(testo)
h.pack_start(button)
window.add(h)
window.show_all()
gtk.main()
So… the question is: what is the difference from GTK and PYGTK ?
pygtkis provided bypython-gobject.gtkis provided bypython-gtk2.pygtkprovides thepygtk.requirefunction which allows you to require that a certain version of gtk (or better) is installed. For exampleimporting
gtkonly is possible, but your program may not work as expected on someone else’s machine if their version of gtk is older.