Tkinter text widget

ezd eugene.druker at gmail.com
Sun Oct 7 03:08:11 EDT 2007


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()

You can scroll, but you can't see the cursor. Use

for x in range(30):
    text.insert(END, "%3d " % x + i)

to check.

ED




More information about the Python-list mailing list