473,804 Members | 2,959 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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(Even t) :
print "Enter - normally lookup a database"
Event.widget.tk _focusNext()

root= Tk.Tk()
Tk.Label(root,t ext='Name').gri d(column=0,row= 0,sticky=Tk.W)
Nm_input= Tk.StringVar()
Nm_entry= Tk.Entry(root,t extvariable=Nm_ input)
Nm_entry.bind(' <Return>',Proc_ Enter)
Nm_entry.grid(c olumn=1,row=0,s ticky=Tk.W)

Tk.Label(root,t ext='City').gri d(column=0,row= 1,sticky=Tk.W)
City_input= Tk.StringVar()
City_entry= Tk.Entry(root,t extvariable=Cit y_input)
City_entry.bind ('<Return>',Pro c_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.p y", 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._nametowid get(name)
File "/usr/lib/python2.5/lib-tk/Tkinter.py", line 1064, in nametowidget
if name[0] == '.':
TypeError: '_tkinter.Tcl_O bj' object is unsubscriptable
-------------------------------------------

--
Helmut Jarausch

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

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

Similar topics

11
23544
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 are the main criteria. thanks, leo
1
2334
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 understanding of what was happening, and partly because pickling Tkinter widgets is an issue that seems to have been touched on over the years but never really acted on. Postings back to '96 have talked about the need to pickle Tk widgets.
7
11909
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 wxPython. Mitchell Timin -- "Many are stubborn in pursuit of the path they have chosen, few in
5
2139
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 plotting into the Tkinter application. For ex: show the dislin result on the Tkinter Canvas. Anyone can help? thx
3
1813
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: ImportError: /usr/lib/python2.3/lib-dynload/_tkinter.so: undefined symbol: PyFPE_jbuf I've tried the following fixes: 1) Recompile Python from scratch. No good. 2) Delete _tkinter.so from /usr/lib/Python2.3/lib-dynload, then
2
2883
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 easiest way of doing this?
4
2176
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: Google's great, but it has no truth meter. Do I inherit from Frame? Or is that a big mistake. (Both positions repeated frequently.) Do I use Tk() or toplevel()? (Support for both and if a cogent explanation of the differences exists, I didn't find it.)
0
820
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. Admittedly we've lived a long time with this bug. But the fix is so simple and so obviously safe that it seems a shame to leave it out. it would be especially nice to get this into the first Python 2.6 release so one could assume the fix is...
4
3989
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 see what's new in the Gui department. I started using Tkinter several years ago and have a lot of stuff written in it. As a result, it's hard to switch to another interface (wxPython, PyQt, etc) with all the hours it would take to reproduce...
0
9704
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9571
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10561
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9132
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7608
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6845
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5639
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4277
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2976
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.