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

<< Previous Entry | FAQ Entry 2.7 | Next Entry >>

2.7. What happened to the GTK and GDK constants/symbols?

The GTK_* constants have been mapped to gtk.* constants, and the GDK_* constants to gtk.gdk.*. The one caveat is that python identifiers can't start with a number. As is done in a few other Python extension modules, pygtk will prefix these constants with an underscore.

So GDK_2BUTTON_PRESS is wrapped as gtk.gdk._2BUTTON_PRESS, while GDK_BUTTON_PRESS is gtk.gdk.BUTTON_PRESS (no underscore).

One exception is the keysyms constants. They are accesed through gtk.keysyms.KEY. To see the legal values of KEY just do a

import gtk print dir(gtk.keysyms)

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