Python tkinter validate issue

I have the following code snippet.

def validateEntries():
    x1 = entry1.get()
    if int(x1) > 5:
        return False
entry1 = Entry(window, validate='all', validatecommand=validateEntries)

Any ideas why the condition does not work?

The following error does occur:

invalid literal for int() with base 10:

Read more here:

Content Attribution

This content was originally published by PurpleHaze at Recent Questions - Stack Overflow, and is syndicated here via their RSS feed. You can read the original post over there.

%d bloggers like this: