Tkinter I want to move forward with the enter key once the data is entered between several entry

0

In the example below, I want to enter the data in each of the cells and when pressing the enter / enter key, accept the data and look for the next one.

I would also add if you can put an entry order in the manner of VisualBasic TabIndex.

from Tkinter import *

root = Tk()
top = Frame(root)
top.pack()

label = Label(top, text='Entrada de Datos continuados con Enter y que salte a la otra casilla')
entry = Entry(top)
entry2 = Entry(top)
entry3 = Entry(top)

label.pack()
entry.pack()
entry2.pack()
entry3.pack()


root.mainloop()
    
asked by Martin Eduardo Laspiur 22.12.2016 в 22:18
source

1 answer

0

You must use event.widget.tk_focusNext().focus()

My Solution:

from tkinter import *


def focus_next_window(event):
    event.widget.tk_focusNext().focus()

root = Tk()


top = Frame(root)
top.pack()

label = Label(top, text='Entrada de Datos continuados con Enter y que salte a la otra casilla')
entry = Entry(top)

entry2 = Entry(top)
entry3 = Entry(top)

label.pack()
entry.pack()
entry2.pack()
entry3.pack()

root.bind("<Return>", focus_next_window)

root.mainloop()
    
answered by 22.12.2016 / 23:59
source