I have a similar problem which I havent solved yet. I only want to input numbers from 0-9 and a "." if I want to input a float number. So far I have this:
def keylistener(event):
ACCEPTED = ["0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "."]
if not event.char in ACCEPTED:
pass
# Dont let the character be inputed
#....
tk.bind('<KeyPress>', keylistener)
can anyone help me?