I have a problem with this part of my program. I have to write data into Tk.Entry, but if I write letter(a,z,R,K....),it crash. I can´t use STRING, because i need input as INT(or FLOAT), because I need input for further calculation. How can I check that input in TK.Entry doesn´t contain letters, but only numbers (1...9,0) (or point (.)). Thank you.
P.S: Please don´t evaluate my code, I know that it´s terrible :-)
import Tkinter as Tk
main=Tk.Tk()
main.minsize(440,330)
hl=Tk.Frame(main)
hl.pack()
def lichobobsvyp(*par):
main.title('Obsah lichoběžníku - Výpočet')
Tk.Label(hl, text ='Obsah lichoběžníku - Výpočet', font ='Arial 15').pack()
rlichobobsa = Tk.LabelFrame(hl, text ='Strany A')
rlichobobsa.pack()
hlichobobsa = Tk.Entry(rlichobobsa, textvariable =thlichobobsa)
hlichobobsa.pack()
Tk.Button(hl, text ='Ok', command = lambda: destroy(lichobobsvysl)).pack()
def lichobobsvysl(*par):
dlichobobsa = float(thlichobobsa.get())
def destroy(x,*par):
for wid in hl.winfo_children():
wid.destroy()
x()
return
thlichobobsa=Tk.DoubleVar()
lichobobsvyp()
main.mainloop()