-
Notifications
You must be signed in to change notification settings - Fork 1
/
table_view.py
39 lines (34 loc) · 1.15 KB
/
table_view.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
from tkinter import *
if __name__=='__main__':
pass
class Table:
def __init__(self,root,total_rows,total_columns):
# code for creating table
for i in range(total_rows):
for j in range(total_columns):
if i==0 or i==1 or j==0:
self.e = Entry(root, width=13, fg='red',
font=('Arial',12,'bold'))
self.e.grid(row=i, column=j)
self.e.insert(END, lst[i][j])
else:
self.e = Entry(root, width=13, fg='blue',
font=('Arial',12,'bold'))
self.e.grid(row=i, column=j)
self.e.insert(END, lst[i][j])
def time_table_data(time_table=None):
global lst
try:
lst = time_table
except exception:
print(exception)
lst=print('Line36: ',time_table)
return lst
def cal(lst):
total_rows = len(lst)
total_columns = len(lst[0])
# create root window
root = Tk()
root.title('Time Table')
t = Table(root,total_rows,total_columns)
root.mainloop()