Hi!
I am working on another program, this time it's a guessing game.
I have spend so many hours late in the night, but i can't figure out how to fix this problem.
I won't the program to read the input number and display if it is bigger, smaller or if you got it.
If i don't tipe enything the if statement works, but if I tipe a number it allways says that is smaller and the counting also doesn't work.
I am still learning the bases, so I would appreciated your help very much.
from Tkinter import*
import random
number = random.randint(1,100)
print number #
tk=Tk()
labelInputNumber=Label(tk,text="Number: ")
labelInputNumber.grid(row=0, column=0)
caseInputNumber=Entry(tk)
caseInputNumber.grid(row=0,column=1)
tries = 0
def number():
tries = 0
Input = caseInputNumber.get()
print Input #
if Input =="":
warningLabel=Label(tk, text="You didn't input enithing") #This works
warningLabel.grid(row=2, column=0)
tries +=1
elif Input < number:
warningLabel=Label(tk, text="The number is bigger!")
warningLabel.grid(row=2, column=0)
tries +=1
elif Input > number:
warningLabel=Label(tk, text="The number is smaller!")
warningLabel.grid(row=2, column=0)
tries +=1
print tries #
buton_try=Button(tk,text = "Guess",command=number)
buton_try.grid(row=0,column=2)