How to decide (and know) which Python GTK version to use?

Akkana Peck akkana at shallowsky.com
Mon Jul 30 13:04:58 EDT 2018


Chris Green writes:
> I wrote a Python GUI program a little while ago that uses Python GTK
> with:-
> 
>     import gtk
> 
> I *think* this is probably GTK 2, or something.  I can't find the
> proper documentation for this.  Is it old/obsolescent?

Yes, it's obsolete, and AFAIK it only works with Python 2, making
it even more obsolete; but the documentation is at
https://developer.gnome.org/pygtk/stable/

> I'm just starting to write another program now and I seem to be using
> GTK 3 (maybe!) by doing:-
> 
>     import gi
>     gi.require_version('Gtk', '3.0')
>     from gi.repository import Gtk
> 
> Is this the right/best place to be?

Yes, this is the future, since it lets you use both GTK3 and Python3.

        ...Akkana



More information about the Python-list mailing list