[Tkinter-discuss] Re: text widget

Fredrik Lundh fredrik at pythonware.com
Fri Oct 15 10:36:59 CEST 2004

Attila Szabo wrote:

> I'm new to TK and like to create text widget
> that allows just 50 characters typed in and just 1 line.
> How to do that ?
> I tried to unbind the Return binding, but it doesn't work to
> allow just 1 line.
> How to limit the number of typed in characters ?
> Have to do myself or has the widget a ready solution ?

if you only need one line, maybe you could use an Entry
widget instead?  see the MaxLengthEntry example on this
page for one way to limit the length:


(more recent versions of Tk also has a validate hook, but
I don't have any ready-made examples for that feature...)


More information about the Tkinter-discuss mailing list