I am writing my very first GUI app with Py and Tkinter (Ttkinter). I want to be sure that the user can write only digits, "," and "." in the entries field. So far I did this but I have a couple of issues:
I am not able to make it accept "," and ".";
Using this method I can't use the clean functions that I wrote to clean the entries widget.
#Validation function
def dig_check(input):
if input.isdigit():
print(input)
return True
else:
print(input)
return False
#Clean function
def clean_calc():
r_top_entry.delete(0,END)
r_bot_entry.delete(0,END)
p_thick_entry.delete(0,END)
b_angle_deg_entry.delete(0,END)
b_angle_m_entry.delete(0,END)
b_angle_s_entry.delete(0,END)
b_height_entry.delete(0,END)
De_label.config(text="-")
Dm_label.config(text="-")
Di_label.config(text="-")
de_label.config(text="-")
dm_label.config(text="-")
di_label.config(text="-")
deg_value.config(text="-")
min_value.config(text="-")
sec_value.config(text="-")
#Entry widget example
r_top_entry = ttk.Entry(blank_frame, width=10, validate="key", validatecommand=(root.register(dig_check),"%P"))
Can someone help me and explain me what am I doing wrong?