How to Create Table in Python GUI Application with Tkinter

Python course with 57 real-time projects - Learn Python

Program 1

from tkinter import *
class Mytable:
    def __init__(self,myroot):
        for i in range(5):
            for j in  range(4):
                self.e=Entry(myroot,width=20,fg='blue',font=('Arial,13,''bold'))
                self.e.grid(row=i,column=j)
                self.e.insert(END,mylist[i][j])


mylist=[('Emp No','Emp Name','Salary','Department'),(101,'Ashok Sharma',80000,'CSE'),(102,'Rajesh Mishra',23000,'IT'),(103,'Vishal Verma',13000,'IT'),(103,'Vishal Verma',13000,'IT'),(103,'Vishal Verma',13000,'IT')]
myroot=Tk()
myroot.geometry('700x500')
myroot.title("Table Demo Application")
myroot.wm_iconbitmap('2.ico')
M1=Mytable(myroot)
myroot.mainloop()

 

We work very hard to provide you quality material
Could you take 15 seconds and share your happy experience on Google

follow dataflair on YouTube

Leave a Reply

Your email address will not be published. Required fields are marked *