tk_focusNext() revisited

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Sori Schwimmer

    #1

    tk_focusNext() revisited

    Hello,

    I am trying to move focus between Tkinter (and other)
    widgets.
    A solution similar with my approach was suggested by
    Eric Brunel at

    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_focus Next().focus_se t()
    File "/usr/local/lib/python2.4/lib-tk/Tkinter.py",
    line 435, in tk_focusNext
    return self._nametowid get(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
    Yahoo Mail: Your smarter, faster, free email solution. Organize your inbox, protect your privacy, and tackle tasks efficiently with AI-powered features and robust security tools.

Working...