I am trying to validate my entry box, that only accepts floats, digits, and operators (+×÷-, %). But my program only accepts numbers not symbols.
I think it is a problem with my conditions or Python Regex.
Here's the code:
from tkinter import *
import reroot = Tk()
def correct(inp):pattern = re.compile(r'^(\d*\.?\d*)$')if pattern.match(inp) is not None:return Trueelif inp is "":return Trueelse:return Falsea = Entry(root)
e = root.register(correct)
a.config(validate='key', validatecommand=(e, '%P'))
a.pack()root.mainloop()