[Tkinter-discuss] Tkinter grid manipulation question

Pekka Niiranen pekka.niiranen at wlanmail.com
Sun Nov 19 12:06:11 CET 2006


Hi,

I found this code from Internet:

from Tkinter import *

rows = []
for i in range(5):
     cols = []
     for j in range(4):
         e = Entry(relief=RIDGE)
         e.grid(row=i, column=j, sticky=N+S+E+W)
         e.insert(END, '%d.%d' % (i, j))
         cols.append(e)
     rows.append(cols)

# print Grid.grid_info(e)

def onPress():
     for row in rows:
         for col in row:
             print col.get(),
         print

Button(text='Fetch', command=onPress).grid()
mainloop()

How can I change its behaviour so that when I hit Enter on current cell
the cursor moves automatically to cell below it?

(I should bind the Enter -button and call <some method>
to adjust current cell location)

-pekka-



More information about the Tkinter-discuss mailing list