Ingin membuat tabel dengan Tkinter? Gunakan Tix.Grid, berikut ini Source Codenya.
# file: gridKu.py
from Tix import *
class DemoGrid:
def __init__(self, parent, title):
self.parent = parent
self.parent.title(title)
#self.parent.geometry("300x200")
self.parent.protocol("WM_DELETE_WINDOW", self.onClose)
self.aturKomponen()
def aturKomponen(self):
mainFrame = Frame(self.parent, bd=10)
mainFrame.pack()
self.tableGrid = Grid(mainFrame, selectunit='cell',
selectmode="multiple")
self.tableGrid.pack(fill=BOTH)
for i in range(5):
for j in range(5):
self.tableGrid.set(i, j, text=str((i, j)))
def onClose(self, event=None):
self.parent.destroy()
if __name__ == '__main__':
root = Tk()
aplikasi = DemoGrid(root, "Demo Grid of Tix")
root.mainloop()