from tkinter import * class Table: def __init__(self,root): # code for creating table for i in range(total_rows): for j in range(total_columns): self.l = Label(root, text=lst[i][j], borderwidth=1, relief="solid", width=20) self.l.grid(row=i, column=j) # take the data lst = [(1, 'Raj', 19, 'Mumbai'), (2, 'Aaryan', 20, 'Pune'), (3, 'Vaishnavi', 18, 'Mumbai'), (4, 'Rachna', 21, 'Agra'), (5, 'Shubham', 21, 'Kanpur'), (6, 'Yogesh', 21, 'Kannuaj')] # find total number of rows and # columns in list total_rows = len(lst) total_columns = len(lst[0]) # create root window root = Tk() t = Table(root) root.mainloop()