pygobject / pgi

[Unmaintained: Use PyGObject instead] GTK+ / GObject Introspection Bindings for PyPy.
GNU Lesser General Public License v2.1
74 stars 16 forks source link

Best way to use gi.require_version #15

Closed stuaxo closed 10 years ago

stuaxo commented 10 years ago

I've been doing the following, but it seems like I should be able to do gi.require_version .. .is this right ?

try:
    import gi
    gi.require_version('Gtk', '3.0')
except ImportError:
    import pgi
    pgi.install_as_gi()
    pgi.require_version('Gtk', '3.0')
lazka commented 10 years ago
# once before any gi import
try:
    import pgi
    pgi.install_as_gi()
except ImportError:
    pass

import gi
gi.require_version('Gtk', '3.0')