[Tkinter-discuss] Text folding of text

Bryan Oakley bryan.oakley at gmail.com
Thu Jan 22 17:57:37 CET 2015


Yes, it is possible, though you have to do a lot of the work yourself. You
can actually intercept the low level text insertions and deletions that
happen as a result of the built-in bindings, and allow or reject the
insertions based on whatever criteria you want.

You can, for example, check the tags surrounding the insertion point when
text is inserted. If you have a tag such as "readonly", you can prevent the
insertion from happening.

Here's a solution that illustrates the technique:
http://stackoverflow.com/a/11180132/7432


On Thu, Jan 22, 2015 at 10:24 AM, Vasilis Vlachoudis <
Vasilis.Vlachoudis at cern.ch> wrote:

>  Dear all,
>
> I want to create a text box with folding capabilities.
> To show/hide lines of text (probably using the elide function)
> but when I hide the text I want it to be replaced by one line
> +---- 10 lines folded ----
> that extends to the full width of the text widget
> and the editing is disabled on that line.
>
> Is it possible to disable the editing on specific lines/tags?
>
> Thanks in advance
> Vasilis
>
>
> _______________________________________________
> Tkinter-discuss mailing list
> Tkinter-discuss at python.org
> https://mail.python.org/mailman/listinfo/tkinter-discuss
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tkinter-discuss/attachments/20150122/e4b080b3/attachment.html>


More information about the Tkinter-discuss mailing list