[pygtk] Good way to determine which version of PyGObject is installed
Simon Feltman
s.feltman at gmail.com
Mon Nov 19 08:42:32 WST 2012
Versioning seems a bit convoluted at the moment. If you are looking for
specific Gtk+ features based on version (not pygobject features) use the
Gtk+ library versions (Gtk.MAJOR_VERSION, Gtk.MINOR_VERSION,
Gtk.MICRO_VERSION)
PyGObject is only providing overrides for the gtk+ typelib, so I would not
necessarily rely on pygobject versioning for anything being pulled in
through the gi.repository. GObject and Gio are part of GLib, and you can
access the version of those with:
(GLib.MAJOR_VERSION, GLib.MINOR_VERSION, GLib.MICRO_VERSION)
Unfortunately, do to the Gtk overrides currently being delivered with
pygobject, there may be Gtk override updates tied to specific pygobject
versions. Depending on what you are trying to achieve, a more robust
technique might be to use "hasattr" for checking if something is available.
-Simon
On Sun, Nov 18, 2012 at 2:12 PM, Osmo Salomaa <otsaloma at iki.fi> wrote:
> 18.11.2012 20:00, Christian Mallwitz wrote:
> > There was a time one could do
> >
> >>>> import gtk
> >>>> gtk.pygtk_version
> > (2, 17, 0)
> >
> > How can I do the same with gi.repository.Gtk when using
> > gobject-introspection from within Python 2? How about GLib and/or
> > Gio?
>
> >>> from gi.repository import GObject
> >>> GObject.pygobject_version
> (3, 2, 2)
>
> And since there is no PyGLib or PyGio, you don't do the same for those.
> PyGObject provides the bindings for GObject, Gtk, GLib and any other
> libraries that support gobject introspection.
>
> --
> Osmo Salomaa <otsaloma at iki.fi>
> _______________________________________________
> pygtk mailing list pygtk at daa.com.au
> http://www.daa.com.au/mailman/listinfo/pygtk
> Read the PyGTK FAQ: http://faq.pygtk.org/
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.daa.com.au/pipermail/pygtk/attachments/20121118/2da88bab/attachment-0001.html>
More information about the pygtk
mailing list