473,414 Members | 1,738 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,414 software developers and data experts.

Tkinter - tk_focusNext broken for years?

Hi,

I'd like to bind the '<Return>' event to a function
which does some calculations (like a database lookup)
and then invoke tk_focusNext.
I get an exception as many others have reported earlier, see
http://bugs.python.org/issue799428
There has even a patch been suggested. Why hasn't it been fixed -
I haven't seen a fix.
The problem can be reproduced by the following tiny script
I'm using Python 2.5.1 .

Should I fixed the Tkinter source myself or is there a workaround?

Many thanks for your help,
Helmut.
-------------------------------------------
import Tkinter as Tk

def Proc_Enter(Event) :
print "Enter - normally lookup a database"
Event.widget.tk_focusNext()

root= Tk.Tk()
Tk.Label(root,text='Name').grid(column=0,row=0,sti cky=Tk.W)
Nm_input= Tk.StringVar()
Nm_entry= Tk.Entry(root,textvariable=Nm_input)
Nm_entry.bind('<Return>',Proc_Enter)
Nm_entry.grid(column=1,row=0,sticky=Tk.W)

Tk.Label(root,text='City').grid(column=0,row=1,sti cky=Tk.W)
City_input= Tk.StringVar()
City_entry= Tk.Entry(root,textvariable=City_input)
City_entry.bind('<Return>',Proc_Enter)
City_entry.grid(column=1,row=1,sticky=Tk.W)

Tk.mainloop()
-------------------------------------------
>>>>>>>>>>>>
Exception in Tkinter callback
Traceback (most recent call last):
File "/usr/lib/python2.5/lib-tk/Tkinter.py", line 1403, in __call__
return self.func(*args)
File "FocusBug.py", line 6, in Proc_Enter
Event.widget.tk_focusNext()
File "/usr/lib/python2.5/lib-tk/Tkinter.py", line 479, in tk_focusNext
return self._nametowidget(name)
File "/usr/lib/python2.5/lib-tk/Tkinter.py", line 1064, in nametowidget
if name[0] == '.':
TypeError: '_tkinter.Tcl_Obj' object is unsubscriptable
-------------------------------------------

--
Helmut Jarausch

Lehrstuhl fuer Numerische Mathematik
RWTH - Aachen University
D 52056 Aachen, Germany
Feb 10 '08 #1
0 1128

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

11
by: Leo | last post by:
hi there for somebody who wants tostart small/medium GUI apps with python: what's the best toolkit: tkinter, wxPython or what? stability, ease of use and portability between mac and windows...
1
by: Marc | last post by:
Hi all, After some research I've decided that my previous question (Confusing problem between Tkinter.Intvar...) was headed in the wrong direction. Partly because I think I have a greater...
7
by: SeeBelow | last post by:
Do many people think that wxPython should replace Tkinter? Is this likely to happen? I ask because I have just started learning Tkinter, and I wonder if I should abandon it in favor of...
5
by: eesun | last post by:
Hi, I've downloaded the dislin package for the scientific plotting. And I have already created the application window with Tkinter (menu, canvas, status bar..). I want to integrate the Dislin...
3
by: Mike Moum | last post by:
Hi, I'm running Mepix Linux, which is a Debian based distribution. Python-2.3.4 is installed in /usr/lib. When I try to import Tkinter into Python, I get the following error message:...
2
by: Dustan | last post by:
How do I limit what the user can enter in an Entry Widget? I know I can set it to display '*' to hide a password, but what I want to do is limit the contents to numeric characters. What is the...
4
by: MartinRinehart | last post by:
Everything I've read about Tkinter says you create your window and then call its mainloop() method. But that's not really true. This is enough to launch a default window from the console: ...
0
by: Russell E. Owen | last post by:
Patch <http://bugs.python.org/issue799428is a trivial (one word) fix to a long-standing issue with Tkinter: calls to the widget method tk_focusNext() fail with "unsubscriptable object" error. ...
4
by: Mudcat | last post by:
So I haven't programmed much in Python the past couple of years and have been catching up the last few days by reading the boards. I'll be making commercial Python applications again and wanted to...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.