Re: [pygtk] gir1.2-gtk-2.0 and gir1.2-gtk-3.0 together

2011-06-17 Thread Marko Tasic
Giuseppe,

Simply require needed version of typelib, and then import it:
import gi
gi.require_version('Gtk', '2.0')
from gi.repository import Gtk

But, you cannot mix 2.0 and 3.0 modules.

Regards,
Marko Tasic


On Thu, Jun 16, 2011 at 8:17 PM, Giuseppe Penone gius...@gmail.com wrote:

 Hi all,

 I'm trying (like many others) to port code from pygtk2 to gi.

 I'm running ubuntu 11.04, I first had only gir1.2-gtk-2.0 and, running the
 following lines:

 from gi.repository import Gtk
 print Gtk

 I get gi.module.DynamicModule 'Gtk' from
 '/usr/lib/girepository-1.0/Gtk-2.0.typelib'

 then I install also gir1.2-gtk-3.0 (together with gtk3), and running the
 same lines I get:

 gi.module.DynamicModule 'Gtk' from
 '/usr/lib/girepository-1.0/Gtk-3.0.typelib'

 so my question is, how can I point to a Gtk version when both 2 and 3 are
 installed?
 Cheers,
 Giuseppe.

 ___
 pygtk mailing list   pygtk@daa.com.au
 http://www.daa.com.au/mailman/listinfo/pygtk
 Read the PyGTK FAQ: http://faq.pygtk.org/

___
pygtk mailing list   pygtk@daa.com.au
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://faq.pygtk.org/

[pygtk] gir1.2-gtk-2.0 and gir1.2-gtk-3.0 together

2011-06-16 Thread Giuseppe Penone
Hi all,

I'm trying (like many others) to port code from pygtk2 to gi.

I'm running ubuntu 11.04, I first had only gir1.2-gtk-2.0 and, running the
following lines:

from gi.repository import Gtk
print Gtk

I get gi.module.DynamicModule 'Gtk' from
'/usr/lib/girepository-1.0/Gtk-2.0.typelib'

then I install also gir1.2-gtk-3.0 (together with gtk3), and running the
same lines I get:

gi.module.DynamicModule 'Gtk' from
'/usr/lib/girepository-1.0/Gtk-3.0.typelib'

so my question is, how can I point to a Gtk version when both 2 and 3 are
installed?
Cheers,
Giuseppe.
___
pygtk mailing list   pygtk@daa.com.au
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://faq.pygtk.org/

Re: [pygtk] gir1.2-gtk-2.0 and gir1.2-gtk-3.0 together

2011-06-16 Thread Pietro Battiston
Il giorno gio, 16/06/2011 alle 20.17 +0200, Giuseppe Penone ha scritto:
 Hi all,
 
 I'm trying (like many others) to port code from pygtk2 to gi.
 
 I'm running ubuntu 11.04, I first had only gir1.2-gtk-2.0 and, running
 the following lines:
 
 from gi.repository import Gtk
 print Gtk
 
 I get gi.module.DynamicModule 'Gtk' from
 '/usr/lib/girepository-1.0/Gtk-2.0.typelib'
 
 then I install also gir1.2-gtk-3.0 (together with gtk3), and running
 the same lines I get:
 
 gi.module.DynamicModule 'Gtk' from
 '/usr/lib/girepository-1.0/Gtk-3.0.typelib'
 
 so my question is, how can I point to a Gtk version when both 2 and 3
 are installed?


Waiting for someone more competent to answer, I can tell you what I was
explained in chat some time ago:

1) introspection picks the latest installed Gtk version, and you can't
change that,

2) still, that's not a huge problem, because any program you want to
write with introspection, you want to write it for Gtk 3, since
introspection+Gtk2 is more a proof of concept than a production-usable
setup (notice I was searching explanations on how to make a menu popup,
and I discovered it's just not possible).

bye

Pietro

___
pygtk mailing list   pygtk@daa.com.au
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://faq.pygtk.org/