Re: ERROR:root:Requiring namespace 'Gtk' version '2.0', but '3.0' is already loaded



On Tue, Nov 16, 2010 at 1:07 PM, John Palmieri <johnp redhat com> wrote:
>> On Tue, Nov 16, 2010 at 11:13 AM, John Palmieri <johnp redhat com>
>> wrote:
>> > from gi.repository import Gtk
>> > Gtk.require_version('2.0')

Ok, just had a chance to try this and it didn't work.

$ python
Python 2.7 (r27:82500, Sep 16 2010, 18:02:00)
[GCC 4.5.1 20100907 (Red Hat 4.5.1-3)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> from gi.repository import Gtk
>>> Gtk.require_version('2.0')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib64/python2.7/site-packages/gtk-2.0/gi/module.py", line
212, in __getattr__
    attribute = getattr(self._dynamic_module, name)
  File "/usr/lib64/python2.7/site-packages/gtk-2.0/gi/module.py", line
88, in __getattr__
    self.__class__.__name__, name))
AttributeError: 'DynamicModule' object has no attribute 'require_version'
>>>

> Actually looking at champlain-gtk source code it already requires clutter so the best way to do this is to use clutter-gtk to embed a canvas into your app and add the champlain clutter actor to the canvas.  My opinion is there is no reason for Champlain to have a Champlain-gtk.  Here si what I do to embed gstreamer:
>
> from gi.repository import Gtk, Clutter, GtkClutter, ClutterGst
>
> window = Gtk.Window()
> ClutterGst.init(sys.argv)
> clutter_window = GtkClutter.Embed()
> window.add(clutter_window)
> video_texture = ClutterGst.VideoTexture()
> video_texture.set_filename("data/intro.ogv")
>
> stage = self.clutter_window.get_stage()
> stage.add_actor(video_texture)
>
> window.connect('delete', lambda x: Gtk.main_quit())
> window.show_all()
>
> Gtk.main()

Ok, so I've tried my best to hack your solution onto my app, and came
up with this:

from gi.repository import GtkClutter, Clutter, Champlain
from gi.repository import Gtk, GObject, Gdk, GdkPixbuf, GConf

class GottenGeography:
    [blah blah app logic code]
    def __init__(self):
        Clutter.init([])
        self.clutter = GtkClutter.Embed()
        self.map_view = Champlain.View()
        [snip...]
        self.map_container.pack_start(self.clutter, True, True, 0)
        [snip...]

But when I run it, I just get this:

$ ./gottengeography.py
Traceback (most recent call last):
  File "./gottengeography.py", line 2050, in <module>
    gui = GottenGeography()
  File "./gottengeography.py", line 1137, in __init__
    self.clutter = GtkClutter.Embed()
  File "/usr/lib64/python2.7/site-packages/gtk-2.0/gi/module.py", line
88, in __getattr__
    self.__class__.__name__, name))
AttributeError: 'DynamicModule' object has no attribute 'Embed'

So, not sure what's going on, but my Gtk and GtkClutter are both
missing out on methods you seem to think ought to be there. I'm using
stock Fedora 14 stuff.

Excerpts from 'yum info':

Name        : clutter-gtk
Arch        : x86_64
Version     : 0.10.8
Release     : 1.fc14

Name        : pygobject2
Arch        : x86_64
Version     : 2.21.5
Release     : 3.fc14

Name        : gobject-introspection
Arch        : x86_64
Version     : 0.9.3
Release     : 1.fc14

Thanks again.

-- 
http://exolucere.ca


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]