2d table of input fields : Table Grid « GUI Tk « Python






2d table of input fields

2d table of input fields
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=NSEW)
        e.insert(END, '%d.%d' % (i, j))
        cols.append(e)
    rows.append(cols)

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

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

           
       








Related examples in the same category

1.Grid made by Label and EntryGrid made by Label and Entry
2.Grids on two windowsGrids on two windows
3.Grid made by the Label with Raised borderGrid made by the Label with Raised border
4.Grid layout manager demonstration.Grid layout manager demonstration.