msg18049 - (view) |
Author: Perry Greenfield (perrygreenfield) |
Date: 2003-09-02 21:58 |
Calls to the widget method tk_focusNext() fail with "unsubscriptable object" error. Looking at the Tkinter.py code for the routine shows this statement: name = self.tk.call('tk_focusNext', self._w) (line 433) which used to return a string in 2.2 but now returns a "cmdName object". When this is passed to self._nametowidget(name), it fails when it tries to subscript name (line 1006) since the object does not support indexing. Perhaps str(name) or name.string is more appropriate now? (when that change is made, it works--well, I tested name.string and that worked) Perry Greenfield (perry@stsci.edu) |
|
|
msg18050 - (view) |
Author: Perry Greenfield (perrygreenfield) |
Date: 2003-09-03 13:29 |
Logged In: YES user_id=252130 Presumably the same problem exists with tk_focusPrev. |
|
|
msg18051 - (view) |
Author: Jeff Epler (jepler) |
Date: 2003-09-07 15:23 |
Logged In: YES user_id=2772 Presumably, _nametowidget() should be modified to work properly with a "cmdName object", rather than modifying each site that gets a widget path from a tk command. |
|
|
msg18052 - (view) |
Author: David Douard (douardda) |
Date: 2005-11-09 15:03 |
Logged In: YES user_id=692511 The problem is still not resolved for now (AFAIK). Here is a very simple patch for Tkinter.py: *** 432,442 **** --- 432,446 ---- to 0.""" name = self.tk.call('tk_focusNext', self._w) if not name: return None + try: name=name.string + except: pass return self._nametowidget(name) def tk_focusPrev(self): """Return previous widget in the focus order. See tk_focusNext for details.""" name = self.tk.call('tk_focusPrev', self._w) if not name: return None + try: name=name.string + except: pass return self._nametowidget(name) def after(self, ms, func=None, *args): """Call function once after given time. Note: I have made this (try/except) cause I have encountered cases where "name" was still a string (well, at least with Python 2.3.1). David (david.douard*gmail.com) |
|
|
msg18053 - (view) |
Author: Rick Litherland (lither) |
Date: 2007-06-07 17:44 |
This problem still persists, at least in Python 2.4. As noted by Perry Greenfield, the same problem occurs in tk_focusPrev, and some other methods as well. Rather than track down all such calls it would be easier to add the line name = str(name) at the top of the nametowidget method. Rick Litherand. lither@math.lsu.edu |
|
|
msg62637 - (view) |
Author: Russell Owen (reowen) |
Date: 2008-02-21 18:10 |
The bug still exists. Please assign this bug and patch to Martin Loewis if possible (I don't have privileges for that). |
|
|
msg64929 - (view) |
Author: Guilherme Polo (gpolo) *  |
Date: 2008-04-04 12:43 |
While we are at it, can't we revamp nametowidget too ? Patch attached |
|
|
msg65747 - (view) |
Author: Guilherme Polo (gpolo) *  |
Date: 2008-04-24 20:38 |
There was a problem with my previous patch if the widget name was just '.' New patch attached |
|
|
msg65748 - (view) |
Author: Guilherme Polo (gpolo) *  |
Date: 2008-04-24 20:40 |
Sorry for the previous patch, correct one attached now |
|
|
msg70621 - (view) |
Author: Martin v. Löwis (loewis) *  |
Date: 2008-08-02 07:24 |
Thanks for the patch, committed as r65399, r65400, and r65401. |
|
|