[Tkinter-discuss] tk_focusNext and tkfocusPrev

HWJ jarausch at skynet.be
Mon Feb 18 20:42:01 CET 2008




Russell E. Owen wrote:
> 
> In article <47B3F0A1.5080206 at gatwick.westerngeco.slb.com>,
>  Martin Franklin <mfranklin1 at gatwick.westerngeco.slb.com> wrote:
> 
> Actually a "window" in tk is a widget. A "whole window" is called a 
> "toplevel" in tk. I find it disconcerting, but at least once I got the 
> hang of that I found the tk documentation made a lot more sense.
> 
> Also focusNext always stays within the current toplevel (according to 
> the manual). But it looks like it only gives you the name of the next 
> widget (window). So I think the solution to the original poster's 
> question is:
> 
> currWdg.tk_focusNext().focus_set()
> 
> -- Russell
> 
> _______________________________________________
> Tkinter-discuss mailing list
> Tkinter-discuss at python.org
> http://mail.python.org/mailman/listinfo/tkinter-discuss
> 
> 
Hi, thanks for the hint, but unfortunately the bug is still there.
Please try the following script:
#!/usr/bin/python
import Tkinter as Tk

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

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()

It still fails for me.

-- 
View this message in context: http://www.nabble.com/tk_focusNext-and-tkfocusPrev-tp15356581p15548084.html
Sent from the Python - tkinter-discuss mailing list archive at Nabble.com.



More information about the Tkinter-discuss mailing list