> from gi.repository import Gdk, Gtk, GObject
> ...
> class ToggleBut(Gtk.Window):
>     def __init__(self, parent=None):
>         self.mywindow = Gtk.Window.__init__(self)
>         self.myobject = GObject.__init__() 

What idiom is this? Why are you constructing self.myobject that way? Why
are you not just super() or chaining up in __init__(self)?


> 
> After that, things fell into place.
> 
> Now I still need some help if poss:
> 
> I took this same python app unchanged to another system where I have built
> packages myself.    It is python 2.6,  but all other packages are the
> latest versions as of very recently. 
> 
> The original pygtk form of the app works fine there, but this pygobject-form 
> fails like so:
> 
> ERROR:root:Could not find any typelib for Gdk
> ERROR:root:Could not find any typelib for Gtk
> Traceback (most recent call last):
>   File "/home/lumby/pythonapps/togglegobj.py", line 24, in <module>
>     from gi.repository import Gdk, Gtk, GObject
> ImportError: cannot import name Gdk
> 
> 
> Any idea why it can't find Gdk and what I could look for to fix it?
> I have stared at install directories and can't see anything amiss  -
> e.g. the set of files in and under:
> F14's           /usr/lib/python2.7/site-packages/gtk-2.0/gi
> custom-sys's    /usr/local/lib/python2.6/site-packages/gtk-2.0/gi
> appear to be the same (names,  not content)
>  except for a couple of libtool xxx.la's in the custom one.
> I can easily upgrade python to 2.7 if that might help but would prefer to have
> some idea what I am looking for.

No idea. Many many things could have gone wrong. Check where the
typelibs are installed and check if they can be found with the
GI_TYPELIB_PATH environment variable (IIRC). Poke about by
printing .__file__ of things which successfully import.

It feels like you are changing far too many things at once, and there is
many subtle ways the libraries could be interacting poorly.

I would start again, chuck everything is ~/bin/ and slowly make it work
one at a time by setting LD_LIBRARY_PATH, PYTHONPATH, GI_TYPELIB_PATH,
etc.

Or just use JHbuild to sandbox everything.

Good luck,

John


> 
> Cheers,    John Lumby
>                                         


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

Reply via email to