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,sticky=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,sticky=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 -- http://mail.python.org/mailman/listinfo/python-list