[Tutor] Limiting Characters
Michael Lange
klappnase at freenet.de
Tue Aug 22 12:01:52 CEST 2006
On Mon, 21 Aug 2006 13:19:54 -0400
"Marcus Dean Adams" <marcusdean.adams at gmail.com> wrote:
> I_m fairly new to python, I_ve been dabbling in it for school and I have a
> question. I_ve written a few programs using graphical windows with input
> boxes such as a stopwatch, temperature converter, etc. I_ve always found a
> gui much prettier than command line. Anyway, I have limited the size of the
> input boxes to the number of digits I wanted, but you can still put more
> digits than that in the box. For example, the temperature converter input
> box is only 3 digits wide, however I can enter a 20 digit number if I want,
> it just only shows 3 digits at a time. How can I actually limit the number
> of characters a user can enter, and not just the size of the input box?
>
>
Hi Marcus,
this depends of course on the toolkit you use.
If it is Tkinter, you can use the Entry widget's validatecommand, see:
http://mail.python.org/pipermail/tkinter-discuss/2006-August/000863.html
I hope this helps
Michael
More information about the Tutor
mailing list