Tkinter: Getting the cursor to blink again in a Text object

J.Jacob joost_jacob at hotmail.com
Thu May 9 08:36:00 EDT 2002


Per chance I found out how to get the cursor to blink again in a
Tkinter.Text object.  Suppose you have a frame variable of type Frame
that has a .text attribute of type Text.
First you do some stuff like scrolling the .text so the cursor
disappears.  I thought this would only happen with
.text['status']=DISABLED but it happens in other circumstances too,
unpredictable for me.
Now you do:
frame.focus()
frame.update()
frame.text.focus()
frame.text.update()
And voila the cursor is back and -blinks- again.

But now the problem is solved I still wonder if there is something
going on I did not understand.  Doing only the 2 frame.text.* lines is
not enough, that will (sometimes and not portably) give a cursor that
does not blink.  I found you have to give focus to something else and
then to your Text widget, but it feels a bit like hacking.  Somebody
knows more about this?

Joost

QOTD:
I hate small towns because once you've seen the cannon in the park
there's nothing else to do.
                -- Lenny Bruce



More information about the Python-list mailing list