tk_focusNext() revisited

Sori Schwimmer sxn02 at yahoo.com
Fri Sep 23 14:28:23 EDT 2005


Hello,

I am trying to move focus between Tkinter (and other)
widgets. 
A solution similar with my approach was suggested by
Eric Brunel at
http://mail.python.org/pipermail/python-list/2004-July/229971.html
It will generate an error:

Exception in Tkinter callback
Traceback (most recent call last):
  File "/usr/local/lib/python2.4/lib-tk/Tkinter.py",
line 1345, in __call__
    return self.func(*args)
  File "ab.py", line 20, in <lambda>
    t.bind('<Tab>', lambda e, t=t: focusNext(t))
  File "ab.py", line 12, in focusNext
    widget.tk_focusNext().focus_set()
  File "/usr/local/lib/python2.4/lib-tk/Tkinter.py",
line 435, in tk_focusNext
    return self._nametowidget(name)
  File "/usr/local/lib/python2.4/lib-tk/Tkinter.py",
line 1006, in nametowidget
    if name[0] == '.':
TypeError: unsubscriptable object

I tried to trace the error in Tkinter.py and found
that name is a cmdName and it is indeed an
unsubscriptable object. It has a string method, and
name.string will print a Tk-style widget name, like
".-1121901300". This one can be used to find the next
widget to jump to, but later the conversion
_nametowidget fails.

What are my options?

Platform: Gentoo, KDE, Tcl/Tk 8.4, Python 2.4.1

Sorin

__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 



More information about the Python-list mailing list