CS Investigatory Project (Python/Tkinter)
CS Investigatory Project (Python/Tkinter)
CS Investigatory Project (Python/Tkinter)
C.L.R.I CHENNAI
SUBMITTED TO :
Smt.S.KIRAN
PGT COMPUTER SCIENCE
SUBMITTED BY :
DINESH BABU S
SANTHOSH A B
AMBAREESH B
[CLASS XI A]
CERTIFICATE
DATE :
TEACHER INCHARGE :
EXAMINER :
PRINCIPAL :
CERTIFICATE
DATE :
TEACHER INCHARGE :
EXAMINER :
PRINCIPAL :
ACKNOWLEDGEMENT
The computer will tell you if each guess is too high or too
low.
import tkinter as tk
from tkinter import *
import random
global radiotop
top = tk.Tk()
top.title("Guess The Number")
dats=('''R0lGODlhwAP0AXAAACwAAAAAwAP0AYcICAj3lBn/lBkQCAgICBAIE
Aj/9wAAc73vGSEQABAAUqUQEBAAEBBjKZT/xYz37zH3lCHO7/cQEAAApVIA
YzoApUr3WikAraXWGVrW1iEAre9rQhDmjBAhGRAIGRlaMRCMUhCUGVqEx
To6KQgIITqUYxC1YxB7ShDO5iFjKYQxGQgAYzG9cxBKMQiMpd7OexDFGULe
exBK5uZK5q3mY7WtY7XmpYTWGRnvUhlCEAgAQmsAazoIlM6lnBDe1hDFpR
A6EDHmY+YZGQCtY+atQnPmQnMZEBk6WjFjGTpCa3OMGTpzIeZCIeZzIbVC
IbWlc3MQvd5KGYRSnEIQlCFzc3u9rb29nFIQUtYQ1kLvrb2UnHOMpUK9teYAS
ikIWowZEBBzY+ZCY+ZzY7VCY7VCSnO1GRBCGWPmc3OU7xnFpYRC3hmMc
zoIQhAQ795zSntaSjGM1jpCQggIjIyElBCc3t7vre+95s7vpVJCpRnmELWtELWM
CBDvGTFjnBmUxRlC3kp7nKU6KTEIWmu9czGMUjoQjGsIQoz37xDv7869SjGU
72tj3hlapeac3q1apa2cpa173uaUzms6peZ73q06pa1aczEIQkJzEGulEHvmEOatE
OZCpXMIlKVaEBClEFrv3mvF3pRC3nvF3koZEACEKRD/xYRjYwjmMbWtMbX
mUinvEHNj3kr3jBkQIWPv3kLe5hkQAMUQ75wQAEoQ72sQIe8Q7xAQcxAQxZ
wQxWsQIcUQxRAQIZRCawjm3ozmMeatMeZjpXPOEHtrKZRj3nvF3mv3xRDvcz
oIa9bmnBkAGRD3GSEAY6XFzgjFziEQjO8AlEoQa0LvSjoAa7XF7wj/1owArVL3j
AjvKRDmjCHm7/dzEJTvCAgZY6UZABD39yG93vjiJyEOQmiRgNluimyjpZFOd3
Hu7AMzdPLEhAAAA7''')
imagePath = PhotoImage(data=dats)
widgetf = Label(top, image=imagePath, bg="#ffad33")
widgetf.place(x=0, y=0)
def play1():
radiotop.destroy()
playtop = tk.Toplevel()
playtop.title("Guess The Number")
random11=random.randint(1,9)
global mistakecount
mistakecount=5
def quit():
playtop.destroy()
def show():
x=("Oops !! You are out of chances!!\nThe Correct Answer is
"+str(random11))
msg.config(text=x)
verify.config(state='disabled')
def correct():
xx=("Yesss !! You got it right\nThe Correct Answer is
"+str(random11))
msg.config(text=xx)
verify.config(state='disabled')
def hint():
hinttop=tk.Toplevel()
hinttop.title("Purchase")
Title=Label(hinttop,text="Buy\nHints",font=('Berlin Sans
FB',26),bg="black",fg='#ff9900')
Title.pack()
hint1=Button(hinttop ,text="$20",command=None,
bg='#33cc33',width=12,bd=9)
hint1.place(x=170,y=120)
hint2=Button(hinttop ,text="$40",command=None,
bg='#33cc33',width=12,bd=9)
hint2.place(x=170,y=220)
hint3=Button(hinttop ,text="$60",command=None,
bg='#33cc33',width=12,bd=9)
hint3.place(x=170,y=320)
hint1l=Label(hinttop,text="1-Hint",font=('HP
Simplified',20),bg="black",fg='#00cc99')
hint1l.place(x=40, y=120)
hint2l=Label(hinttop,text="2-Hints",font=('HP
Simplified',20),bg="black",fg='#00cc99')
hint2l.place(x=40, y=220)
hint3l=Label(hinttop,text="10-Hints",font=('HP
Simplified',20),bg="black",fg='#00cc99')
hint3l.place(x=40, y=320)
hinttop.config(background='black')
hinttop.geometry('300x400')
hinttop.resizable(False, False)
hinttop.mainloop()
ddats1=('''R0lGODlhlQFBAnAAACH5BAEAAP8ALAAAAACVAUEChwAAAGOc/2
OU/////zqM/+a1hN6Ua++9jO9rMTqE91qM7/fFOve1Ou/FpebWveale0KM7++1l
O97Me/v797e3u+thL2EWvfFrSFrzsWMa961jGuU70pztUKM/ykpSvfejNale97W1n
OEtebFjIyErc5zGSFavc6EWpRzY71zQt7enL2Me+alY95zOhkhMc7OxbVzWrWt3n
NzaxkhrYycpe/OOu8ACIQZ5oQZte/OWq2ttealOtacY5yEa+alGQhaxSF75jp73ua
1e4RK5oRKtRlSc4Te5lJzjITexUo6QhlSEBneWhneEMW9vebW1nucpRBaziFr3rVzt
Wuc9/fmpe9z5pRzjBlSUsWEQhkZEBmErQBKxRkZcxmtaxmtIUoZ5koZtUpza0pKW
t6MQgBKtXN7lK2lpUpKtRBC3s7W1pSMjFIZjIw6EBkZ5hnO5hnOrfelOoxCjL331lK
EEIwQEIwQa4x75kpKhBlSMb2ce3OlxRDv5ua9vebmWu8Qe8UQexneexneMRmlr
VI6EJSlveY6EEqtnPfWpUpK5pR7EEoQQlIQEOZjjBml5u+HvVJz+iP2Vm6Lkm7bRi
O7ryaUUeB+h7cvu+INMHtB8rVh0l179rqCWNznOMVbbh32IJk4ERG+jYpNIVYyF
/FmvpYzZWDZfu+FmY4DStMQ1dfC96RZz2xsuo4db5Muu17Ga4WbavMK9zutG/1
wovnI4XUtO2tJz6nJq9S+5q+kKS7t8JLmyZL4tf0D2x+35R5Z3sEYUFjGX7xvX+nIMzl
jxiIgnXUpGjeuyyCuixtwgSrcLCSFqzAB8L2x0/r7+efU6edexQmYzzT6712qz1/ah8
A9CdMIh2Xi4KYeaNp0z8IbBX+I5+1sgfrSCasuS+hKq3NOz/CUhjrCKk3ijHVsIpAE
ywbKBhBCgQC7dMapxrA9xuyoMIvrakv7XNAGkvBE9xBgElBGRunRcEAThBCBm
TB8mNBICi/KOCEmGmxFPyjcXqJ7uNBKjQWLqMmUIqxBcNCmaEmGluwFPyiWK
tCMuyZX1gOL0ucrwgTDgg/NBSTIOAA5ipDOqxDO7xDPMxDPdxDPuxDP/xDQA
xEQRxEQixEQzxERExERVxERmxER3xESIxESZxESqxES7zE8QgIADs=''')
imagePath = PhotoImage(data=ddats1)
widgetf1 = Label(playtop, image=imagePath, bg="black")
widgetf1.place(x=490, y=2)
Title=Label(playtop,text="GUESS THE NUMBER(1-10)",font=('Goudy
Stout',26),bg="black",fg='#ff9900')
Title.place(x=20, y=70)
guesslabel= Label(playtop,text="What's Your Guess?",font=('Courier
New',24),bg="black",fg='white')
guesslabel.place(x=20,y=170)
pa=Button(playtop ,text="Hint",command=hint,height=3,width=25,
bg='#ff0000',bd=9,fg="#ffffff")
pa.place(x=240,y=410)
def verify1():
msg.config(text='')
guess=inputbox.get("1.0",'end')
global mistakecount
if mistakecount>1:
if int(guess)>random11 :
mistakecount-=1
ddats1=None
inputbox.delete('1.0', END)
inputbox.insert('1.0','')
msg.config(text="Your guess is greater than the number")
mistakeclabel.config(text='Chances Left:'+
str(mistakecount))
elif int(guess)<random11:
mistakecount-=1
inputbox.delete('1.0', END)
inputbox.insert('1.0','')
msg.config(text="Your guess is smaller than the number")
mistakeclabel.config(text='Chances:'+str(mistakecount))
elif int(guess)==random11:
mistakecount-=1
inputbox.delete('1.0', END)
inputbox.insert('1.0','')
msg.config(text="Yesss !! You got it right")
inputbox.config(state="disabled")
mistakeclabel.config(text='Chances
Left:'+str(mistakecount))
else:
mistakecount=0
mistakeclabel.config(text='Chances:'+str(mistakecount))
msg.config(text="Oops !! You are out of chances!!")
pa.config(state="normal")
verify.config(state='disabled')
if int(guess)==random11:
msg.config(text="Yesss !! You got it right")
if int(guess)==random11:
verify.config(state='disabled')
inputbox.config(state="disabled")
def verify(event):
msg.config(text='')
guess=inputbox.get("1.0",'end')
global mistakecount
if mistakecount>1:
if int(guess)>random11 :
mistakecount-=1
inputbox.delete('1.0', END)
inputbox.insert('1.0','')
msg.config(text="Your guess is greater than the number")
mistakeclabel.config(text='Chances
Left:'+str(mistakecount))
elif int(guess)<random11:
mistakecount-=1
inputbox.delete('1.0', END)
inputbox.insert('1.0','')
msg.config(text="Your guess is smaller than the number")
mistakeclabel.config(text='Chances:'+str(mistakecount))
elif int(guess)==random11:
mistakecount-=1
inputbox.delete('1.0', END)
inputbox.insert('1.0','')
msg.config(text="Yesss !! You got it right :)")
correct()
inputbox.config(state="disabled")
mistakeclabel.config(text='Chances
Left:'+str(mistakecount))
else:
mistakecount=0
mistakeclabel.config(text='Chances:'+str(mistakecount))
msg.config(text="Oops !! You are out of chances!!")
verify.config(state='disabled')
pa.config(state="normal")
show()
if int(guess)==random11:
verify.config(state='disabled' )
if int(guess)==random11:
msg.config(text="Yesss !! You got it right :)")
verify.config(state='disabled')
correct()
inputbox.config(state="disabled")
playtop.bind('<Return>',verify)
verify=Button(playtop,text="Verify",command=verify1, height =3,
width=11,bd=7.5)
verify.place(x=290,y=210)
playtop.config(background='black')
playtop.geometry('960x500')
playtop.resizable(False, False)
playtop.mainloop()
def play2():
radiotop.destroy()
playtoplvl2 = tk.Toplevel()
playtoplvl2.title("guess The Number")
random11=random.randint(10,99)
global mistakecount11
mistakecount11=15
def quit():
playtoplvl2.destroy()
def show():
x=("Oops !! You are out of chances!!\nThe Correct Answer is
"+str(random))
msg11.config(text=x)
verify.config(state='disabled')
def correct():
xx=("Yesss !! You got it right\nThe Correct Answer is
"+str(random11))
msg11.config(text=xx)
verify.config(state='disabled')
def hint():
hinttop=tk.Toplevel()
hinttop.title("Purchase")
Title=Label(hinttop,text="Buy\nHints",font=('Berlin Sans
FB',26),bg="black",fg='#ff9900')
Title.pack()
hint1=Button(hinttop ,text="$20",command=None,
bg='#33cc33',width=12,bd=9)
hint1.place(x=170,y=120)
hint2=Button(hinttop ,text="$40",command=None,
bg='#33cc33',width=12,bd=9)
hint2.place(x=170,y=220)
hint3=Button(hinttop ,text="$60",command=None,
bg='#33cc33',width=12,bd=9)
hint3.place(x=170,y=320)
hint1l=Label(hinttop,text="1-Hint",font=('HP
Simplified',20),bg="black",fg='#00cc99')
hint1l.place(x=40, y=120)
hint2l=Label(hinttop,text="2-Hints",font=('HP
Simplified',20),bg="black",fg='#00cc99')
hint2l.place(x=40, y=220)
hint3l=Label(hinttop,text="10-Hints",font=('HP
Simplified',20),bg="black",fg='#00cc99')
hint3l.place(x=40, y=320)
hinttop.config(background='black')
hinttop.geometry('300x400')
hinttop.resizable(False, False)
hinttop.mainloop()
ddats1=('''R0lGODlhlQFBAnAAACH5BAEAAP8ALAAAAACVAUEChwAAAGOc/2
OU/////zqM/+a1hN6Ua++9jO9rMTqE91qM7/fFOve1Ou/FpebWveale0KM7++1l
O97Me/v797e3u+thL2EWvfFrSFrzsWMa961jGuU70pztUKM/ykpSvfejNale97W1n
OEtebFjIyErc5zGSFavc6EWpRzY71zQt7enL2Me+alY95zOhkhMc7OxbVzWrWt3n
NzaxkhrYycpe/OOu8ACIQZ5oQZte/OWq2ttealOtacY5yEa+alGQhaxSF75jp73ua
1e4RK5oRKtRlSc4Te5lJzjITexUo6QhlSEBneWhneEMW9vebW1nucpRBaziFr3rVzt
Wuc9/fmpe9z5pRzjBlSUsWEQhkZEBmErQBKxRkZcxmtaxmtIUoZ5koZtUpza0pKW
t6MQgBKtXN7lK2lpUpKtRBC3s7W1pSMjFIZjIw6EBkZ5hnO5hnOrfelOoxCjL331lK
EEIwQEIwQa4x75kpKhBlSMb2ce3OlxRDv5ua9vebmWu8Qe8UQexneexneMRmlr
VI6EJSlveY6EEqtnPfWpUpK5pR7EEoQQlIQEOZjjBml5u+15sVCEJTmQkq1QpTm
EEq1EIxCY5R7Qr1CQr1je0oZY4St5ow6Qkp73hBj3qXvnFKEQowQQqXOc1JaQhn
vrebvGVJaEObOGYwQjN61nCkhOuYQMYxaEEq15kp770rm7+8xeyFKrcUxe706
5r06tUqtc0q1xUrmxb0Q5r0QtZStQkrmQuZjtZStEErmEL1j5uY6QlKM1sUQOnPmE
rmnHPmc0rmcxmMWhmMEJyle9allOZaY7XmQmu1QrXmEGu1EHOte4xaQuaMY
6XFnKXvc7XW5lKMvc4QCO865u86te8Q5u8QtbWtQmvmQuaEtbWtEGvmEL2E5
ubv1hmMexmMMeaMewharda1e7XWvSFjpRkAQlKc3lqM/fZIXH8swvVfbzJAV1D
wjx2hktaa0zX5gvW4KFr9PhagANy0Ygl2GzOJu4WyrhCXzbnNNFk6TswWsPAPOj
dqU9h0GlCXU6DZ7m2jLV7SMBqVULVInonrUCLXysirGcJt9y9qCtksszc1bzp9s8nT
6WbywIkQz+6Va0RC5m7uwkif3MrVNDKIZKYr2q+OicILs4RVjyVvik1HmnEq3LV
hJxfDiKI8V29SIFcsOvMR7qRVC0JTpRlPYeMcrqjSN5bSZU5oDm2yyUCEoXayVsZIr
swp0alc7jv8Fl1U8ehX7mctbXY8A33xzq6D/HvVJz+iP2Vm6Lkm7bRiO7ryaUUeB+
h7cvu+INMHtB8rVh0l179rqCWNznOMVbbh32IJk4ERG+jYpNIVYyF/FmvpYzZW
DZfu+FmY4D==''')
imagePath = PhotoImage(data=ddats1)
widgetf1 = Label(playtoplvl2, image=imagePath, bg="black")
widgetf1.place(x=490, y=2)
msg11=Label(playtoplvl2,text='',font=("Courier New",
20),bg="black",fg='white')
msg11.place(x=10,y=340)
exit1=Button(playtoplvl2 ,text="Quit",command=quit,height =3,
bg='#33cc33',width=25,bd=9)
exit1.place(x=20,y=410)
pa=Button(playtoplvl2 ,text="Hint",command=hint,height
=3,width=25,bg='#ff0000',bd=9,fg="#ffffff")
pa.place(x=240,y=410)
def verify1():
msg11.config(text='')
guess11=inputbox11.get("1.0",'end')
global mistakecount11
if mistakecount11>1:
if int(guess11)>random11 :
mistakecount11-=1
ddats1=None
inputbox11.delete('1.0', END)
inputbox11.insert('1.0','')
msg11.config(text="Your guess is greater than the
number")
mistakeclabel11.config(text='Chances
Left:'+str(mistakecount11))
elif int(guess11)<random11:
mistakecount11-=1
inputbox11.delete('1.0', END)
inputbox11.insert('1.0','')
msg11.config(text="Your guess is smaller than the
number")
mistakeclabel11.config(text='Chances:'+str
(mistakecount11))
elif int(guess11)==random11:
mistakecount11-=1
inputbox11.delete('1.0', END)
inputbox11.insert('1.0','')
msg11.config(text="Yesss !! You got it right")
correct()
inputbox11.config(state="disabled")
mistakeclabel11.config(text='Chances
Left:'+str(mistakecount11))
else:
mistakecount11=0
mistakeclabel11.config(text='Chances:'+str(mistakecount11))
msg11.config(text="Oops !! You are out of chances!!")
pa.config(state="normal")
verify.config(state='disabled')
if int(guess11)==random11:
msg11.config(text="Yesss !! You got it right")
correct()
inputbox11.config(state="disabled")
def verify(event):
msg11.config(text='')
guess11=inputbox11.get("1.0",'end')
global mistakecount11
if mistakecount11>1:
if int(guess11)>random11 :
mistakecount11-=1
inputbox11.delete('1.0', END)
inputbox11.insert('1.0','')
msg11.config(text="Your guess is greater than the
number")
mistakeclabel11.config(text='Chances
Left:'+str(mistakecount11))
elif int(guess11)<random11:
mistakecount11-=1
inputbox11.delete('1.0', END)
inputbox11.insert('1.0','')
msg11.config(text="Your guess is smaller than the number
")
mistakeclabel11.config(text='Chances:'+str(mistakecount11))
elif int(guess11)==random11:
mistakecount11-=1
inputbox11.delete('1.0', END)
inputbox11.insert('1.0','')
msg11.config(text="Yesss !! You got it right")
correct()
inputbox11.config(state="disabled")
mistakeclabel11.config(text='Chances
Left:'+str(mistakecount11))
else:
mistakecount11=0
if mistakecount11==0:
mistakeclabel11.config(text='Chances:'+str(mistakecount11))
msg11.config(text="Oops !! You are out of chances!!")
pa.config(state="normal")
show()
verify.config(state='disabled')
if int(guess11)==random11:
msg11.config(text="Yesss !! You got it right")
verify.config(state='disabled')
correct()
inputbox11.config(state="disabled")
playtoplvl2.bind('<Return>',verify)
playtoplvl2.config(background='black')
playtoplvl2.geometry('960x500')
playtoplvl2.resizable(False, False)
playtoplvl2.mainloop()
def play3():
radiotop.destroy()
playtoplvl3 = tk.Toplevel()
playtoplvl3.title("Guess The Number")
random1=random.randint(99,999)
global mistakecount11
mistakecount11=20
def quit():
playtoplvl3.destroy()
def show():
x=("Oops !! You are out of chances!!\nThe Correct Answer is
"+str(random1))
msg11.config(text=x)
verify.config(state='disabled')
def correct():
xx=("Yesss !! You got it right\nThe Correct Answer is "+str(random1))
msg11.config(text=xx)
verify.config(state='disabled')
def hint():
hinttop=tk.Toplevel()
hinttop.title("Purchase")
Title=Label(hinttop,text="Buy\nHints",font=('Berlin Sans
FB',26),bg="black",fg='#ff9900')
Title.pack()
hint1=Button(hinttop ,text="$20",command=None,
bg='#33cc33',width=12,bd=9)
hint1.place(x=170,y=120)
hint2=Button(hinttop ,text="$40",command=None,
bg='#33cc33',width=12,bd=9)
hint2.place(x=170,y=220)
hint3=Button(hinttop ,text="$60",command=None,
bg='#33cc33',width=12,bd=9)
hint3.place(x=170,y=320)
hint1l=Label(hinttop,text="1-Hint",font=('HP
Simplified',20),bg="black",fg='#00cc99')
hint1l.place(x=40, y=120)
hint2l=Label(hinttop,text="2-Hints",font=('HP
Simplified',20),bg="black",fg='#00cc99')
hint2l.place(x=40, y=220)
hint3l=Label(hinttop,text="10-Hints",font=('HP
Simplified',20),bg="black",fg='#00cc99')
hint3l.place(x=40, y=320)
hinttop.config(background='black')
hinttop.geometry('300x400')
hinttop.resizable(False, False)
hinttop.mainloop()
ddats1=('''R0lGODlhlQFBAnAAACH5BAEAAP8ALAAAAACVAUEChwAAAGOc/2
OU/////zqM/+a1hN6Ua++9jO9rMTqE91qM7/fFOve1Ou/FpebWveale0KM7++1l
O97Me/v797e3u+thL2EWvfFrSFrzsWMa961jGuU70pztUKM/ykpSvfejNale97W1n
OEtebFjIyErc5zGSFavc6EWpRzY71zQt7enL2Me+alY95zOhkhMc7OxbVzWrWt3n
NzaxkhrYycpe/OOu8ACIQZ5oQZte/OWq2ttealOtacY5yEa+alGQhaxSF75jp73ua
1e4RK5oRKtRlSc4Te5lJzjITexUo6QhlSEBneWhneEMW9vebW1nucpRBaziFr3rVzt
Wuc9/+6Va0RC5m7uwkif3MrVNDKIZKYr2q+OicILs4RVjyVvik1HmnEq3LVhJxfDi
KI8V29SIFcsOvMR7qRVC0JTpRlPYeMcrqjSN5bSZU5oDm2yyUCEoXayVsZIrswp0
alc7jv8Fl1U8ehX7mctbXY8A33xzq6D/HvVJz+iP2Vm6Lkm7bRiO7ryaUUeB+h7cvu
+INMHtB8rVh0l179rqCWNznOMVbbh32IJk4ERG+jYpNIVYyF/FmvpYzZWDZfu+F
mY4DStMQ1dfC96RZz2xsuo4db5Muu17Ga4WbavMK9zutG/1wovnI4XUtO2tJz6nJ
q9S+5q+kKS7t8JLmyZL4tf0D2x+35R5Z3sEYUFjGX7xvX+nIMzljxiIgnXUpGjeuyyC
uixtwgSrcLCSFqzAB8L2x0/r7+efU6edexQmYzzT6712qz1/ah8A9CdMIh2Xi4KYea
Np0z8IbBX+I5+1sgfrSCasuS+hKq3NOz/CUhjrCKk3ijHVsIpAEywbKBhBCgQC7d
MapxrA9xuyoMIvrakv7XNAGkvBE9xBgElBGRunRcEAThBCBmTB8mNBICi/KOCE
mGmxFPyjcXqJ7uNBKjQWLqMmUIqxBcNCmaEmGluwFPyiWKtCMuyZX1gOL0uc
rwgTDgg/NBSTIOAA5ipDOqxDO7xDPMxDPdxDPuxDP/xDQAxEQRxEQixEQzxE
RExERVxERmxER3xESIxESZxESqxES7zE8QgIADs=''')
imagePath = PhotoImage(data=ddats1)
widgetf1 = Label(playtoplvl3, image=imagePath, bg="black")
widgetf1.place(x=490, y=2)
msg11=Label(playtoplvl3,text='',font=("Courier New",
20),bg="black",fg='white')
msg11.place(x=10,y=340)
pa=Button(playtoplvl3 ,text="Hint",command=hint,height
=3,width=25,bg='#ff0000',bd=9,fg="#ffffff")
pa.place(x=240,y=410)
def verify1():
msg11.config(text='')
guess11=inputbox11.get("1.0",'end')
global mistakecount11
if mistakecount11>1:
if int(guess11)>random1 :
mistakecount11-=1
ddats1=None
inputbox11.delete('1.0', END)
inputbox11.insert('1.0','')
msg11.config(text="Your guess is greater than the
number")
mistakeclabel11.config(text='Chances
Left:'+str(mistakecount11))
elif int(guess11)<random1:
mistakecount11-=1
inputbox11.delete('1.0', END)
inputbox11.insert('1.0','')
msg11.config(text="Your guess is smaller than the
number")
mistakeclabel11.config(text='Chances:'+str(mistakecount11))
elif int(guess11)==random1:
mistakecount11-=1
inputbox11.delete('1.0', END)
inputbox11.insert('1.0','')
msg11.config(text="Yesss !! You got it right")
correct()
inputbox11.config(state="disabled")
mistakeclabel11.config(text='Chances
Left:'+str(mistakecount11))
else:
mistakecount11=0
mistakeclabel11.config(text='Chances:'+str(mistakecount11))
msg11.config(text="Oops !! You are out of chances!!")
pa.config(state="normal")
verify.config(state='disabled')
if int(guess11)==random1:
msg11.config(text="Yesss !! You got it right")
correct()
inputbox11.config(state="disabled")
def verify(event):
msg11.config(text='')
guess11=inputbox11.get("1.0",'end')
global mistakecount11
if mistakecount11>1:
if int(guess11)>random1 :
mistakecount11-=1
inputbox11.delete('1.0', END)
inputbox11.insert('1.0','')
msg11.config(text="Your guess is greater than the
number")
mistakeclabel11.config(text='Chances
Left:'+str(mistakecount11))
elif int(guess11)<random1:
mistakecount11-=1
inputbox11.delete('1.0', END)
inputbox11.insert('1.0','')
msg11.config(text="Your guess is smaller than the
number ")
mistakeclabel11.config(text='Chances:'+str(mistakecount11))
elif int(guess11)==random1:
mistakecount11-=1
inputbox11.delete('1.0', END)
inputbox11.insert('1.0','')
msg11.config(text="Yesss !! You got it right")
correct()
inputbox11.config(state="disabled")
mistakeclabel11.config(text='Chances
Left:'+str(mistakecount11))
else:
mistakecount11=0
if mistakecount11==0:
mistakeclabel11.config(text='Chances:’
+str(mistakecount11))
msg11.config(text="Oops !! You are out of chances!!")
pa.config(state="normal")
show()
verify.config(state='disabled')
if int(guess11)==random1:
msg11.config(text="Yesss !! You got it right")
verify.config(state='disabled')
correct()
inputbox11.config(state="disabled")
playtoplvl3.bind('<Return>',verify)
def selecter():
global radiotop
radiotop=Tk()
radiotop.title("Level?")
label1 = Label( radiotop, text="\nSELECT LEVEL")
label1.config(font=("Comic Sans MS",15))
label1.pack()
try:
def playlvl1():
play1()
def playlvl2():
play2()
def playlvl3():
play3()
var = StringVar(value="1")
radiotop.resizable(False, False)
radiotop.geometry("210x220")
radiotop.mainloop()
except:
print("error in selector")
def quit():
top.destroy()
def instructions():
instop = tk.Toplevel()
instop.title("Guess The Number")
instop.config(background='black')
instop.geometry('480x490')
instop.resizable(False, False)
instop.mainloop()
def credits():
crdtop = tk.Toplevel()
crdtop.title("Credits")
widgetf2 = Label(crdtop,
text="CREDITS",bg="#004d26",font=("Rockwell",26),fg="#80ff00")
widgetf2.pack()
widgetf3 = Label(crdtop, text = "
PRODUCERS",bg="#004d26",font=("Rockwell",18),fg="#80ff00")
widgetf3.pack()
widgetf3.place(x=20,y=90)
widgetf4 = Label(crdtop, text = "Babu &
Co.",bg="#004d26",font=("Rockwell",18),fg="#80ff00")
widgetf4.pack()
widgetf4.place(x=400,y=90)
widgetf4 = Label(crdtop, text =
":",bg="#004d26",font=("Rockwell",18),fg="#80ff00")
widgetf4.pack()
widgetf4.place(x=320,y=90)
crdtop.config(bg="#004d26")
crdtop.geometry('685x460')
crdtop.resizable(False, False)
crdtop.mainloop()
play=Button(top,text="Play",command=selecter,height =3,
width=25,bg='#ff0000',bd=9,fg="#ffffff")
play.place(x=50,y=377)
credits=Button(top,text="Credits",command=credits,height =3,
bg="#6699ff",width=25,bd=9)
credits.place(x=490,y=377)
top.config(background='black')
top.geometry('960x500')
top.resizable(False, False)
top.mainloop()
SAMPLE OUTPUT SCREENS
FUTURE ENHANCEMENTS
GUI REFERENCES
https://wiki.python.org/moin/TkInter
https://www.tutorialspoint.com/python/python_gui_progra
mming.htm
CONCEPTUAL REFERENCES
https://www.python.org/
https://inventwithpython.com/chapter4.html
https://www.slideshare.net/
https://www.youtube.com/?reload=9
CONCLUSION