[EMAIL PROTECTED]:~$ ipython
Python 2.4.4c0 (#2, Jul 4 2006, 18:39:05)
In [1]: import gtk
In [2]: print "\n".join(filter(lambda x: x[0] == "F", dir(gtk.keysyms))) # Nothing the first time
In [3]: print "\n".join(filter(lambda x: x[0] == "F", dir(gtk.keysyms ))) # OK now!
F
F1
F10
F11
F12
F13
F14
[continues]
First_Virtual_Screen
or, isolating the problem:
In [1]: import gtk
In [2]: gtk.keysyms
Out[2]: <gtk._lazyutils.LazyModule object at 0xb6eecfac> ### Ahnn. Lazy...
In [3]: dir(gtk.keysyms) # Errr...
Out[3]:
['__class__',
'__delattr__',
'__dict__',
'__doc__',
'__getattr__',
'__getattribute__',
'__hash__',
'__init__',
'__module__',
'__new__',
'__reduce__',
'__reduce_ex__',
'__repr__',
'__setattr__',
'__str__',
'__weakref__',
'_locals',
'_modname',
'_name']
In [4]: gtk.keysyms
Out[4]: <module 'gtk.keysyms' from '/var/lib/python-support/python2.4/gtk- 2.0/gtk/keysyms.pyc'> # Module changed...
In [5]: dir(gtk.keysyms)
Out[5]:
*Huge list of strings with F11 and all the others*
so, the problem is with lazy modules not "waking up"
then I read at http://www.nabble.com/dynamic-namespace-t2018133.html (method __getattr__) of LazyModule how to get the whole module, not the lazy version.
Now it is working this way:
Instead of:
class Keys(object):
keysyms = gtk.keysyms
gdk = gtk.gdk
I'm using:
class Keys(object):
keysyms = __import__(gtk.keysyms._name, gtk.keysyms._locals, {}, ' ') # Getting the whole module gtk.keysyms
# Didn't touch the rest of code
Works fine.
Is it a bug in Ubuntu, PyGTK or the interactive shell? or None?
--
Best Regards
Leandro Lameiro
Blog: http://lameiro.redirectme.net/blog
On 8/4/06, Felix Rabe (public) <
[EMAIL PROTECTED]> wrote:
Felix Rabe (public) wrote:
> I don't really expect it to work for you, so then the last resort is to
> comment out line 44 (the one binding the F11 key) and try again.
I should go to bed - I meant "line 44 in pygsh/window.py".
_______________________________________________ pygtk mailing list [email protected] http://www.daa.com.au/mailman/listinfo/pygtk Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/
