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.vlachou...@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@python.org
> https://mail.python.org/mailman/listinfo/tkinter-discuss
>
>
_______________________________________________
Tkinter-discuss mailing list
Tkinter-discuss@python.org
https://mail.python.org/mailman/listinfo/tkinter-discuss

Reply via email to