This issue tracker has been migrated to GitHub ,
and is currently read-only.
For more information,
see the GitHub FAQs in the Python's Developer Guide.
Created on 2003年09月02日 21:58 by perrygreenfield, last changed 2022年04月10日 16:10 by admin. This issue is now closed.
| Files | ||||
|---|---|---|---|---|
| File name | Uploaded | Description | Edit | |
| Tkinter_patch.txt | reowen, 2008年02月21日 18:10 | Path for Tkinter.py based on current svn | ||
| bugfix_and_revamp_nametowidget.diff | gpolo, 2008年04月24日 20:40 | |||
| Messages (10) | |||
|---|---|---|---|
| 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) * (Python committer) | 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) * (Python committer) | 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) * (Python committer) | Date: 2008年04月24日 20:40 | |
Sorry for the previous patch, correct one attached now |
|||
| msg70621 - (view) | Author: Martin v. Löwis (loewis) * (Python committer) | Date: 2008年08月02日 07:24 | |
Thanks for the patch, committed as r65399, r65400, and r65401. |
|||
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2022年04月10日 16:10:59 | admin | set | github: 39177 |
| 2008年08月02日 07:25:12 | loewis | set | status: open -> closed resolution: fixed versions: + Python 2.6, Python 3.0 |
| 2008年08月02日 07:24:55 | loewis | set | messages: + msg70621 |
| 2008年04月24日 20:40:35 | gpolo | set | files:
+ bugfix_and_revamp_nametowidget.diff messages: + msg65748 |
| 2008年04月24日 20:40:06 | gpolo | set | files: - bugfix_and_revamp_nametowidget.diff |
| 2008年04月24日 20:38:38 | gpolo | set | files:
+ bugfix_and_revamp_nametowidget.diff messages: + msg65747 |
| 2008年04月24日 20:38:24 | gpolo | set | files: - bugfix_and_revamp_nametowidget.diff |
| 2008年04月04日 12:43:55 | gpolo | set | files:
+ bugfix_and_revamp_nametowidget.diff nosy: + gpolo messages: + msg64929 |
| 2008年03月21日 22:07:33 | gvanrossum | set | assignee: loewis nosy: + loewis |
| 2008年02月21日 20:11:16 | loewis | set | keywords: + patch |
| 2008年02月21日 18:10:20 | reowen | set | files:
+ Tkinter_patch.txt nosy: + reowen type: behavior messages: + msg62637 versions: + Python 2.5, - Python 2.3 |
| 2003年09月02日 21:58:36 | perrygreenfield | create | |