RE: [pygtk] python and GTK+-3 - possible?
- From: John Lumby <johnlumby hotmail com>
- To: John Stowers <john stowers lists gmail com>
- Cc: python-hackers-list gnome org, pygtk_pygobject maillist <pygtk daa com au>
- Subject: RE: [pygtk] python and GTK+-3 - possible?
- Date: Wed, 16 Mar 2011 11:11:13 -0400
J Stowers wrote:
>
> > > From what I understand, pygobject can only provide GTK3 and pygtk can
> > > only provide GTK2.
>
> pygtk.py (what gets executed above) lives in pygobject. This, for
> historical reasons lived there to help easy the pain of the pygtk-1 ->
> pygtk-2 transition. This is why you see pygtk.require(2.0) at the top of
> some programs (although this has not been necessary for some time).
>
> pygtk.py does some things with sys.path to choose which native code gets
> imported. We might start requiring people to call pygtk.require(2.0)
> again in future, depending on the parallel installation capabilities of
> the static parts of pygobject, however I think that discussion is
> ongoing, and not something you should worry about (Dieter, J5, is that
> correct, I have been AFK for a while)
>
> > Actually I think it's possible that
> > 'from gi.repository import Gtk'
> > may give you GTK+2; I think it depends on which (version of) GTK
> > was introspected into whichever gi repository your python finds.
> > Not suggesting this is what you want - just my experience.
>
> This is not correct. One can choose the version of the typelib to be
> loaded; e.g.
>
> >>> import gi
> >>> gi.require_version("Gtk", "2.0")
> >>> from gi.repository import Gtk
> >>> Gtk.Switch
> --> Fails
>
> But the annotations are most up to date in the Gtk-3 overrides, so I
> would suggest letting it choose the most recent typelib by default, that
> is
>
> >>> from gi.repository import Gtk
> >>> Gtk.Switch
> ---> Works
>
> And gives you gtk+-3.
>
> If you want to use gtk+-2 I suggest you stick with pygtk.
>
Thanks for the explanation. I am starting to get it.
Would this be a true statement regarding the role that pygobject plays:
(Please correct it)
"pygobject today provides two different roles :
1. support for pygtk to use static bindings to
Gobject, Gio, Gdk, Gtk.
Support for Gtk is for GTK+2 only, not GTK+3
2. support for python apps to use dynamic python bindings for
Gobject, Gdk, Gio, Gtk and others, each introspected from their
respective packages. GTK version can be altered
by choice of package during introspection
and also overridden in the application by require,
but support is intended for GTK+3."
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]