How do I get an integer type from the Tkinter Entry widget?
If I try to get the value using variable_name.get(), it says it is a str. If I try to change the type using int(variable_name.get()), it says int can only accept a string or number.
Any help would be welcome!
In the end I just initialized the variable as tk.IntVar() instead of tk.StringVar()
That way you don't have to cast it as an int, it will always be one, and the default value from the Entry element will now be 0 instead of ''
That's how I approached it anyway, seems the simplest way and avoid the need for a lot of the validation you'd need to do otherwise...
Get an Integer from Entry