I once got started on a PyGtk and Glade tutorial but never finished it. Recently I saw that PyGtk is being depreciated in favor of using introspection at https://wiki.ubuntu.com/MeetingLogs/appdevweek1104/GObjectIntrospection and https://wiki.ubuntu.com/MeetingLogs/appdevweek1104/PyGI. I decided to try learning more of python and Gtk again using the new way. The pages I linked to seem to show how you would do it if I wanted to make the GUI in the code, but I like to use Glade. Is there a way to do this and still use the new introspection?
Yes, in fact it's almost exactly the same:
Many smaller programs will take little effort to convert. You can start by switching to gobject introspection using the following two lines, and then correct any errors by looking them up in the reference.
Keep in mind that you need Glade 3.10 or newer to build a GTK 3 interface. 3.8 or older is for GTK 2. In Ubuntu, the packages are called
If you need to convert an (old) PyGTK app to PyGI, you should try the pygi-convert script that comes with the PyGObject tarball. In a lot of cases, this should be enough to transform your application. It is also found in GIT: http://git.gnome.org/browse/pygobject/tree/pygi-convert.sh
The following link should help too with some basic explanation of the common things that have changed: https://live.gnome.org/PyGObject/IntrospectionPorting
And finally, here is an (very nice) effort to create a PyGI tutorial: http://readthedocs.org/docs/python-gtk-3-tutorial/en/latest/index.html
I find it usefull to have a look at the C docs when building something: http://developer.gnome.org/gtk3/
Once you know how everything is done in Python, this can be a very good resource for things that aren't documented yet. Let's have a look at the gtk.RESPONSE_OK example given in the other answer. When going to the C docs, you'll find this: http://developer.gnome.org/gtk3/3.2/GtkDialog.html#GtkResponseType
Take the enum name (GtkResponseType) and split the 'Gtk' part by a dot and add the enum type without the GTK_* part, so you'll get: