Tkinter: cut'n'paste from DISABLED window?

Michael Geary Mike at DeleteThis.Geary.com
Tue Apr 6 22:10:38 EDT 2004


Patrick L. Nolan wrote:
> Our Tkinter application has a big ScrolledText widget which is
> a log of everything that happens.  In order to prevent people
> from making changes, we have it in DISABLED mode except when
> the program wants to write a new entry.  This works OK, except
> that sometimes we want to copy out of piece of the contents and
> paste it in another window.  When it's DISABLED, it appears
> that we can't even select a portion of the text.
>
> Is this an either-or situation?  Or is there some clever way to
> get around it?
>
> If it matters, we want this to work on both Linux and Windows.

I don't know if this will help, but maybe it will provide a hint...

In a native Windows app, the way you do this is to make the edit control
read-only instead of disabled. For example, if you right-click a file in
Windows and select Properties, you'll notice that you can select and copy
text from any of the text fields in the General tab of the property sheet.

The way this is done is by making those text fields Edit controls with the
ES_READONLY style (and without the WS_DISABLED style).

-Mike





More information about the Python-list mailing list