Source Code
tt-{}
print(' **WELCOME TO TIME TABLE GENERATOR*******)
print(" -+')
print(' |)
print(" This Project Will Help To Generate )
print(' AFunctioning Time Table: I)
print(" |)
print(" +)
while True:
a=[]
a11-input("if u want to enter data in a new file --->1 else 2:\t ")
FILE=input("enter file name to be created and stored: \t")
print("\n")
print(":::The data is bieng stored in",FILE, "file in the current directory:::")
print('- --")
classs=input('enter the class name:")
print('=
b=int(input('enter the no of staffs min-->6 and maX-->7:'))
print('======
===)
print('!!caution the time table consists of only 4 periods in a day!!")
print('====:
print(' MAKE SURE THAT YOUENTER THE STAFF IN 3 or 4 LETTERS FOR
BETTER RESULT)
print('n
)
i=1
while i<=b:
print('enter the staff code no.',ji,end='")
c=input(':)
a.append(c)
i=i+1
week=)
print("\n")
print('
print('ensure that you enter the same spelling of days always')
print('===
print(':: Now You Are Required To Enter The Day !"IN Alphabets"!:)
print("\n")
while True:
h=0
period=[]
day=input('enter the day:')
from random import randint
while h4:
e=randint(0, b-1)
period.append(a[e])
g-period.count(a[e])
for z in tt:
for y in tt[z]:
if y==day:
if tt[z][yl[h]=-a[e]:
period.pop(h)
h=h-1
while g>2:
period.pop(h)
h=h-1
break
h=h+1
week[day]=period
n=input('tostop entering the days you are required to enter----> [n]:')
--2--:-3-
print('=-zzz
print("\n")
if n=='n':
break
tt[classs]=week
n=input('You are required to enter---> (n] to stop the entry of a new class:
)
if nin ['NO''no', n', N'):
break
for z in tt:
print("\n")
print('(--(----------(--}----)
print(z)
for y in tt[z]:
print(y,':",end=")
print(tt[z][ly))
import csv
if a11 ==1:
f_1=open(FILE+'.csv',"a+")
p1=[tt(z]lyl]
a2-[yl+p1
al=csv.writer(f_1)
a1.writerow(a2)
f_1.close()
else:
f_1=open(FILE+'.csv',"a")
p1=[tt[z]lyl]
a2=[y]+p1
al=csv.writer(f_1)
al.writerow(a2)
f_1.close()
while True:
print("\n")
print('Do you want to change any period:")
u=input("YES or NO:\t)
if u in [YES,'yes','y']:
print('=|=|=|=|=|=|=|=|=|=|=|=|=|=|=|=|=|=|=|=|=|=|=|=|=|=|)
w=input('Enter the class in which you want to change the period:\t')
r=input(Enter the day:')
t=int(input('Enter the period number:')
q=input('Enter the changed period:')
tt[w][rl[t-1]=q
for z in tt:
print([|-l+-1+1+1-+-+-+++-+-+-H+-1++-+-1+1+-++f
I+-l+-]+[-+-+-+-l)
print(z)
for y in tt[z]:
print(y,',end=")
print(tt[z]ly)
import csv
if a11 ==1:
f_1=open(FILE+'.csv', "a+")
p1=[tt[zllyl]
a2=lyl+p1
al=csv.writer(f_1)
a1.writerow(a2)
f_1.close)
else:
f_1=open(FILE+".csv',"a")
p1=[tt[z][yl]
a2=lyl+p1
al=csv.writer(f_1)
al.writerow(a2)
f_1.close()
else:
print("THANK YOU")
rows=9
for i in range (0, rows):
for jin range(0, i+ 1):
print("* ", end=")
print("\")
for iin range (rows, 0, -1):
for j in range(0, i -1):
print("*", end='")
print("\")
break
from tkinter import *
root = Tk()
root.geometry('250x200')
btnm = Button(root, text ='Mon')
btnm.grid(row =0, column =0, padx = 4,pady =4)
btnm1 = Button(root, text = 'Tue')
btnm1.grid(row = 1, column =0, padx =4, pady =4)
btnm11 = Button(root, text = 'Wed')
btnm11.grid(row =2, column =0, padx =4, pady =4)
btnm111 = Button(root, text ='Thur')
btnm111.grid(row =3, column =0, padx =4, pady =4)
btnm1111 =Button(root, text ='Fri')
btnm1111.grid(row =4, column =0, padx =4, pady =4)
btnm11111 = Button(root, text = 'Sat')
btnm11111.grid(row =5, column =0, padx =4, pady =4)
def changeText():
if(btn1('text']=='Math):
btn1['text']=Chem'
elif(btn1[text']==Chem'):
btn1['text}='Add'
elif(btn1['text']=='Add'):
btn1['text']=Phy'
elif(btn1['text']=='Phy'):
btn1['text]='P.ed'
elif(btn1['text']=='P.ed'):
btn1['text']=Eng'
elif(btn1[text']=='Eng'):
btn1('text']='Holi.'
else:
btn1['text']='Math'
btn1 =Button(root, text ='btn1 !,
command = changeText)
btn1.grid(row =0, column =1, padx =4, pady =4)
def changeText():
if(btn2[text']=='Math'):
btn2['text]=Chem'
elif(btn2['text']=='Chem'):
btn2['text']='Add'
elif(btn2('text']=='Add'):
btn2['text}=Phy'
elif(btn2['text']=='Phy'):
btn2['text']='P.ed'
elif(btn2['text']=='P.ed'):
btn2['text]=Eng'
elif(btn2['text'}=='Eng'):
btn2['text']=Holi.!'
else:
btn2['text']='Math'
btn2 =Button(root, text ='btn2 !,command =changeText)
btn2.grid(row =0, column =2, padx =4, pady =4)
def changeText():
if(btn3['text']=='Math'):
btn3[text']='Chem'
elif(btn3[text']==Chem'):
btn3['text]='Add'
elif(btn3[text']==Add'):
btn3[('text]=Phy'
elif(btn3[text']=='Phy'):
btn3[text']='P.ed'
elif(btn3[text']=='P.ed'):
btn3['text'Eng'
elif(btn3[text']=='Eng'):
btn3['text']='Holi.!'
else:
btn3[text']='Math'
btn3 = Button(root, text = 'btn3 !', command = changeText)
btn3.grid(row =0, column =4, padx =4, pady =4)
def changeText():
if(btn4[text']=='Math'):
btn4[text']='Chem'
elif(btn4['text']==Chem'):
btn4['text']='Add'
elif(btn4['text']=='Add'):
btn4['text']=Phy'
elif(btn4['text']=='Phy'):
btn4[text']='P.ed'
elif(btn4[text']=='P.ed'):
btn4['text']='Eng'
elif(btn4['text']=='Eng'):
btn4[text]='Holi.!'
else:
btn4['text']='Math'
btn4 = Button(root, text = 'btn4 !',command = changeText)
btn4.grid(row =0, column =6, padx =4, pady =4)
def changeText():
if(btn11['text']=='Math'):
btn11['text']='Chem'
elif(btn11['text]==Chem'):
btn11['text]='Add'
elif(btn 11['text']=='Add'):
btn11['text']='Phy'
elif(btn11['text']=='Phy'):
btn11['text]='P.ed'
elif(btn11['text']=='P.ed'):
btn11['text']='Eng'
elif(btn11['text']=='Eng'):
btn11['text']='Holi.'
else:
btn11[text']='Math
btn11 = Button(root, text = 'btn1 !',
command = changeText)
btn11.grid(row =1, column =1, padx =4, pady =4)
def changeText():
if(btn21[text']=='Math'):
btn21['text']='Chem'
elif(btn21['text']=='Chem'):
btn21['text']='Add'
elif(btn21['text']=='Add'):
btn21['text]='Phy'
elif(btn21['text']=='Phy'):
btn21['text']='P.ed'
elif(btn21['text']=='P.ed'):
btn21['text']='Eng'
elif(btn21['text']=='Eng'):
btn21[text']='Holi.'
else:
btn21['text']='Math'
btn21 = Button(root,text ='btn2 !',command =changeText)
btn21.grid(row =1, column =2, padx =4, pady =4)
def changeText():
if(btn31['text']=='Math'):
btn31['text']='Chem'
elif(btn31['text']=='Chem'):
btn31['text']='Add'
elif(btn31[text']=='Add'):
btn31['text']='Phy'
elif(btn31['text']=='Phy'):
btn31[text']='P.ed'
elif(btn31[text']=='P.ed'):
btn31['text']=Eng'
elif(btn31['text']=='Eng'):
btn31['text']='Holi.'"
else:
btn31['text']='Math'
btn31 =Button(root, text ='btn3 !', command =changeText)
btn31.grid(row = 1,column =4, padx =4, pady =4)
def changeText():
if(btn41[text']=='Math'):
btn41['text]=Chem'
elif(btn41['text']=='Chem'):
btn41['text']='Add'
elif(btn41['text']=='Add'):
btn41['text']='Phy'
elif(btn41['text']=='Phy'):
btn41['text]='P.ed'
elif(btn41['text']=='P.ed'):
btn41['text']='Eng'
elif(btn41['text']=='Eng'):
btn41[text']='Holi.!'
else:
btn41['text']='Math'
btn41 = Button(root, text ='btn4 !', command =changeText)
btn41.grid(row =1, column =6, padx = 4, pady =4)
def changeText():
if(btn111['text']==Math'):
btn111['text']='Chem'
elif(btn111['text']==Chem'):
btn111['text]='Add'
elif(btn111['text']=='Add'):
btn111['text]='Phy'
elif(btn111[text' ]=='Phy):
btn111['text']=P.ed'
elif(btn111['text']=='P.ed'):
btn111['text']='Eng'
elif(btn111['text']=='Eng'):
btn111['text']='Holi.'
else:
btn111[text']='Math'
btn111 = Button(root, text = 'btn1 !,
command = changeText)
btn111.grid(row = 2, column = 1, padx =4, pady =4)
def changeText():
if(btn211['text']=='Math'):
btn211['text']='Chem'
elif(btn211['text']=='Chem'):
btn211['text']='Add'
elif(btn211['text']=='Add'):
btn211[(text']='Phy'
elif(btn211['text']=='Phy'):
btn211['text']='P.ed'
elif(['text]==P.ed'):
btn211['text']='Eng'
elif(btn211['text']==Eng'):
btn211['text']='Holi.!"
else:
btn211['text']='Math'
btn211 = Button(root, text = 'btn2 !',command = changeText)
btn211.grid(row= 2, column =2,padx = 4,pady =4)
def changeText():
if(btn311['text']=='Math'):
btn311['text']=Chem'
elif(btn311['text']==Chem'):
btn311['text']='Add'
elif(btn311['text']=='Add'):
btn311['text']='Phy'
elif(btn311['text']=='Phy'):
btn311['text']='P.ed'
elif(btn311['text']==P.ed'):
btn311['text']='Eng'
elif(btn311['text']=='Eng'):
btn311['text']='Holi."
else:
btn311['text']='Math'
btn311 = Button(root, text = 'btn3
!', command = changeText)
pady =4)
btn311.grid(row = 2, column =4, padx =4,
def changeText():
if(btn411[('text']=='Math'):
btn411['text']=Chem'
elif(btn411('text']=='Chem'):
btn411['text']='Add'
elif(btn411{'text']=='Add'):
btn411['text']='Phy'
elif(btn411['text']=='Phy'):
btn411['text']='P.ed'
elif(btn411['text']=='P.,ed'):
btn411['text']='Eng'
elif(btn411('text']=='Eng'):
btn411['text']='Holi. !
else:
btn411['text']='Math'
Button(root, text = 'btn4 !", command = changeText)
btn411 =
pady = 4)
btn411.grid(row = 2, column = 6, padx = 4,
def changeText():
if(btn1111['text']=='Math'):
btn1111[text']=Chem'
elif(btn1111['text']==Chem'):
btn1111[(text']='Add'
elif(btn1111['text']=='Add'):
btn1111['text']='Phy'
elif(btn1111['text']=='Phy'):
btn1111['text']='P.ed'
elif(btn1111['text']=='P.ed'):
btn1111['text']='Eng'
elif(btn1111['text']==Eng'):
btn1111['text']='Holi.'
else:
btn1111['text']='Math'
btn1111 =Button(root, text = 'btn1 !',
command = changeText)
btn1111.grid(row =3, column = 1, padx =4, pady =4)
def changeText():
if(btn2111['text'] =='Math'):
btn2111['text']=Chem'
elif(btn2111['text']=='Chem'):
btn2111['text']='Add'
elif(btn2111['text']=='Add'):
btn2111[text']='Phy'
elif(btn2111['text'] ==Phy'):
btn2111['text']='P.ed'
elif(btn2111['text']=='P.ed'):
btn2111[(text']='Eng'
elif(btn2111['text']==Eng'):
btn2111['text']='Holi.'
else:
btn2111[text']='Math'
btn2111= Button(root, text ='btn2 !,command = changeText)
btn2111.grid(row= 3, column =2, padx =4, pady =4)
def changeText():
if(btn3111['text']=='Math'):
btn3111[text']='Chem'
elif(btn3111('text']==Chem'):
btn3111['text']='Add'
elif(btn3111['text']=='Add'):
btn3111['text']=Phy'
elif(btn3111['text']=='Phy'):
btn3111['text']='P.ed'
elif(btn3111['text']=='P.ed'):
btn3111['text']='Eng'
elif(btn3111['text']=='Eng'):
btn3111['text']='Holi.'
else:
btn3111('text']='Math'
command = changeText)
btn3111 = Button (root, text = 'btn3 !,
btn3111.grid(row=3, column =4, padx = 4, pady =4)
def changeText():
if(btn4111['text']=='Math'):
btn4111['text']=Chem'
elif(btn4111['text']==Chem'):
btn4111['text']='Add'
elif(btn4111['text']=='Add'):
btn4111['text']='Phy'
elif(btn4111['text']=='Phy'):
btn4111['text']='P.ed'
elif(btn4111['text']=='P.ed'):
btn4111['text']='Eng'
elif(btn4111['text']=='Eng'):
btn4111[text']='Holi.'
else:
btn4111['text']='Math'
changeText)
btn4111 = Button(root, text = 'btn4 !, command =
btn4111.grid(row =3, column = 6, padx = 4, pady =4)
def changeText():
if(btn11111['text']=='Math'):
btn11111['text']=Chem'
elif(btn11111['text']=-Chem'):
btn11111['text']='Add'
elif(btn11111[(text']==Add'):
btn11111['text']='Phy'
elif(btn11111['text']=='Phy'):
btn11111['text']='P.ed'
elif(btn11111['text']=='P.ed'):
btn11111[text]='Eng'
elif(btn11111['text']=='Eng'):
btn11111['text']='Holi.!'
else:
btn11111['text']='Math'
btn11111 =Button(root, text = 'btn1 !,
command = changeText)
btn11111.grid(row =4, column = 1,padx= 4, pady =4)
# Creating a Button
def changeText():
iffbtn21111['text']=='Math'):
btn21111['text']='Chem'
elif(btn21111['text']==Chem'):
btn21111['text']='Add'
elif(btn21111['text']=='Add'):
btn21111[text']='Phy'
elif(btn21111['text' ]=='Phy'):
btn21111[text']='P.ed'
elif(btn21111['text']==P.ed'):
btn21111['text']='Eng'
elif(btn21111['text']=='Eng'):
btn21111['text']='Holi.'
else:
btn21111(text]='Math'
btn21111 =Button(root, text ='btn2 !,command =changeText)
btn21111.grid(row =4, column =2, padx =4, pady =4)
# Creating a Button
def changeText():
if(btn31111['text']=='Math'):
btn31111['text']='Chem'
elif(btn31111['text']=='Chem'):
btn31111['text']='Add'
elif(btn31111['text']=='Add'):
btn31111[text']-=Phy'
elif(btn31111['text']=='Phy'):
btn31111[text']='P.ed'
elif(btn31111['text']=='P.ed'):
btn31111['text']='Eng'
elif(btn31111['text']=='Eng'):
btn31111['text']='Holi."
else:
btn31111['text']='Math'
changeText)
btn31111 = Button(root, text ='btn3 !, command=
btn31111.grid(row =4, column =4, padx =4, pady =4)
# Creating a Button
def changeText():
if(btn41111('text']=='Math'):
btn41111['text']='Chem'
elif(btn41111['text']=='Chem'):
btn41111['text']='Add'
elif(btn41111['text']=='Add'):
btn41111['text']='Phy'
elif(btn41111['text']==Phy'):
btn41111[text']='P.ed'
elif(btn41111[(text']==P.ed'):
btn41111['text']='Eng'
elif(btn41111['text']=-'Eng'):
btn41111['text']='Holi.!"
else:
btn41111['text']='Math'
btn41111= Button(root, text ='btn4 !,command = changeText)
btn41111.grid(row =4, column = 6, padx =4, pady =4)
# Creating a Button
def changeText():
if(btn111111['text']=='Math'):
btn111111['text']=Chem'
elif(btn111111['text']==Chem"):
btn111111['text']='Add'
elif(btn1['text']=='Add'):
btn111111[text]='Phy'
elif(btn111111['text']='Phy'):
btn111111['text']='P.ed'
elif(btn111111('text']==P.ed'):
btn111111f'text']='Eng'
elif(btn111111['text']=-Eng'):
btn111111['text']='Holi.'
else:
btn111111['text']='Math'
btn111111 = Button(root, text ='btn1 !,
command=changeText)
btn111111.grid(row=5, column =1, padx =4, pady =4)
# Creating a Button
def changeText():
if(btn211111['text']=-'Math'):
btn211111['text']='Chem'
elif(btn211111['text'] ==Chem'):
btn211111['text']='Add'
elif(btn211111['text']==Add'):
btn211111['text']='Phy'
elif(btn211111('text']=='Phy'):
btn211111['text']='P.ed'
elif(btn211111['text']==P.ed'):
btn211111['text']='Eng'
elif(btn211111('text ]='Eng'):
btn211111['text']='Holi.'
else:
btn211111['text']='Math'
btn211111 =Button(root, text ='btn2 !',command =changeText)
btn211111.grid(row =5, column =2, padx = 4, pady =4)
# Creating a Button
def changeText():
if(btn311111['text']=='Math'):
btn311111['text']='Chem'
elif(btn311111['text']==Chem'):
btn311111['text']='Add'
elif(btn311111['text']==Add'):
btn311111['text']=Phy'
elif(btn311111['text']=='Phy'):
btn311111['text']='P.ed'
elif(btn311111['text'] ==P.ed'):
btn311111['text']='Eng'
elif(btn311111['text']==Eng'):
btn311111[text']='Holi."
else:
btn311111['text']='Math'
btn311111 =Button(root, text ='btn3 !, command =changeText)
btn311111.grid(row =5, column =4, padx =4, pady =4)
# Creating aButton
def changeText():
if(btn411111('text']=='Math'):
btn411111['text']='Chem'
elif(btn411111['text']=-Chem'):
btn411111['text']='Add'
elif(btn411111['text'] ==Add'):
btn411111['text']='Phy'
elif(btn411111['text'}==Phy'):
btn411111['text']='P.ed'
elif(btn411111[text']=='P.ed'):
btn411111['text]='Eng'
elif(btn411111('text']=='Eng'):
btn411111['text']='Holi."'
else:
btn411111['text']='Math'
btn411111 = Button(root, text = 'btn4 !', command = changeText)
btn411111-grid(row = 5, column = 6, padx = 4, pady = 4)
root.mainloop()