Tkinter text widget

goldtech goldtech at worldpost.com
Mon Oct 8 10:09:59 EDT 2007


On Oct 7, 11:00 am, Simon Forman <sajmik... at gmail.com> wrote:
> On Oct 6, 11:18 pm, goldtech <goldt... at worldpost.com> wrote:
>
>
>
> > I thought the "DISABLED" made it so I could not edit it. But it also
> > makes it so I can not scroll down. If you make the window smaller than
> > the content then try to put a cursor in there to use up/down arrow you
> > can't.
>
> > What I want is not to be able to change text content, but no other
> > action is disabled. Is this complicated to do?
>
> > Thanks.
>
> > from Tkinter import *
> > root = Tk()
> > text = Text(root, font=("Courier"))
> > text.pack()
> > i='123456789abcdefghijklmnopqrstuvwxyz\n'
> > for x in range(30):
> >     text.insert(END, i)
> > text.config(state=DISABLED)
> > mainloop()
>
> I just tried this script.  You can select text and if you drap the
> selection outside the window then scrolling occurs, also Tk's default
> behavior of scrolling with the middle button still works (i.e. click-
> and-drag with the middle button to scroll.)

Yes, if I depress the mouse's scroll wheel (the middle button) I can
drag the content up/down. Interesting...I didn't know that. But I
can't select, XP Python 2.1.

I'll try adding scroll bars. Thanks.

...snip...




More information about the Python-list mailing list