[pygtk] Interactive PyGTK shell that works on win32 as well
Leandro Lameiro
lameiro at gmail.com
Sat Aug 5 12:55:37 WST 2006
Ahn. Maybe it is because I am using Ubuntu Edgy, which is not ready for
production use yet, but, I think I found the reason.
lameiro at lameiro-laptop:~$ 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] =3D=3D "F", dir(gtk.keysyms))=
) #
Nothing the first time
In [3]: print "\n".join(filter(lambda x: x[0] =3D=3D "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 =3D gtk.keysyms
gdk =3D gtk.gdk
I'm using:
class Keys(object):
keysyms =3D __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) <public at felixrabe.textdriven.com> 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".
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.daa.com.au/pipermail/pygtk/attachments/20060805/a6a9edae/at=
tachment.htm
More information about the pygtk
mailing list