Python+Glade+Gtk tutorial?

Michael Torrie torriem at gmail.com
Tue Mar 17 18:54:51 EDT 2015


On 03/16/2015 10:13 AM, Dave Farrance wrote:
> So am I understanding this correctly:  If I use this include line:
> 
> "from gi.repository import Gtk, Gdk, GObject, Pango" etc...
> 
> ... I get, in effect, the libraries used in Gnome-3 even with python2?
> Whatever "gi.repository" is?  It's a bit hard to figure this out from the
> complexity of differing versions that I've turned up from Google searches.
> 
> Am I on the right track now?  Glade is a good choice for GUI building? And
> even though I'm using Python2, I should be ignoring all examples turned up
> by searching for "PyGTK" because they all seem to be GTK+2 and obsolete?
> Is that "Python GTK+3 Tutorial" as good as any for me to work through?
> 
> https://python-gtk-3-tutorial.readthedocs.org/en/latest/

Yes it's a good choice.  And even with Python 2, GTK3 is a good choice
also.  GTK3 bindings are done somewhat differently than GTK2.  They are
done in a more dynamic fashion through introspection. The nice thing is,
with the gi.repository thing (which stands for gobject introspection),
you can easily make Python bindings to any GObject-based C library.

If you want to use GTK2, that's also possible, and GtkBuilder does work
with it.  I can post an example if you want.





More information about the Python-list mailing list