I've got to stop making these, JOKES
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
| from tkinter import *
from random import *
app = Tk()
app.title('Guess the number')
app.geometry('400x300')
ment = IntVar()
num = randint(1, 10)
def rand():
ges = ment.get()
if ges > num:
l = Label(app, text='{} is too high!'.format(ges)).place(x=165, y=70)
elif ges < num:
l = Label(app, text='{} is too low!'.format(ges)).place(x=165, y=70)
elif ges == num:
l = Label(app, text='{} is correct!'.format(ges)).place(x=165, y=70)
return
la = Label(app, text='Guess the secret number between 1 and 10!').pack()
guess = Entry(textvariable=ment).pack()
guess_button = Button(app, text='Guess!', command=rand).pack()
app.mainloop()
|