3

It's been widely discussed that a few things changed from Python2/Gtk2 to Python3/Gtk+3. I got along with that so far, but there is one thing I am having trouble with: Where did all the constants go?

In Python 2.x I could just do gtk.RESPONSE_OK and now I can do (after a lot of trying around, I found) Gtk.ResponseType.OK

Question: Is there any complete and comprehensive list/documentation of where the specific constants went?

3 Answers 3

3

Please see the introspection porting guide: https://wiki.gnome.org/Projects/PyGObject/IntrospectionPorting

In terms of a "complete and comprehensive" list, the pygi-convert.sh script is probably the closest thing you will find. Its use is for porting PyGTK programs to PyGObject 3, but could very much serve as the list you are looking for: https://git.gnome.org/browse/pygobject/tree/pygi-convert.sh

If you find anything missing from the script, please log a bug or even better submit a patch: https://bugzilla.gnome.org/enter_bug.cgi?product=pygobject

2

This reference should really help you out:

https://lazka.github.io/pgi-docs/Gtk-3.0/constants.html

In general this is a good page to look for PyGObject stuff:

https://lazka.github.io/pgi-docs/Gtk-3.0/index.html

You can also search his Github account for code examples: https://github.com/lazka

1

The idea behind that is that the introspector converts GTK_ENUMTYPE_ELEMENT to Gtk.ENUMTYPE.ELEMENT for gtk3 python bindings (gi). So having a look at the original Gtk+-3 .x documentation suffices (i.e. using devhelp). (why not have a look at the binding doc itself anyways?).

Not the answer you're looking for? Browse other questions tagged or ask your own question.