Tkinter GUI Error

Christian Gollwitzer auriocus at gmx.de
Tue Jan 14 16:33:23 EST 2014


Am 14.01.14 22:27, schrieb Lewis Wood:
> Also anyone know how to create an entry box for Tkinter where you can only enter in 2 digits?
>
You must use a validator to achieve this. This is a more advanced topic 
though. A validator is a function that is called whenever the user keys 
something in - even by copy/pasting - and has to decide, whether this 
change is accepted or not. It is relatively easy to annoy your users if 
the validator is not written carefully. For instance, you must always 
accept th eempty string, otherwise the users won't be able to delete 
everything - very annoying behaviour.

See for example this SO question

http://stackoverflow.com/questions/4140437/python-tkinter-interactively-validating-entry-widget-content

	Christian



More information about the Python-list mailing list