Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Slow updates in Tk text widget 1

Status
Not open for further replies.

Mephistophales

Programmer
Jul 9, 2001
1
US
I have a program consisting of multiple procedures wrapped in a Tk GUI. The GUI has a text widget (.statusWin) and a button (.runUpdate) with the following syntax:

Code:
button .runUpdate -text "Run Auto Update" -command    {.statusWin delete 0.0 end; runAutoUpdate}

'runAutoUpdate' is a procedure that calls other procedures which, in turn, write to '.statusWin' as they run, as such:

Code:
.statusWin insert end "text"

However, when the button is pressed, the GUI freezes for a few seconds as the procedures are running, and then erases the contents of '.statusWin' and dumps, all at once, the text that was supposed to be written line-by-line.

So all of the output that all of the procedures were supposed to write progressively to '.statusWin' get written at once.

I've checked - this isn't simply due to very fast execution; I've had this program run in command-line mode and output to the console - the text is progressively outputted, not all at once.

If anyone has seen a situation like this, please let me know. I'm sorry if this may be unclear, but it's hard to describe.

Thank you.
 
Wish usually defers updating screen contents until it sees idle time. You can force a screen update by inserting 'update idletasks' after the '.statusWin delete 0.0 end', and after each call to the update procedures.

Mike Suttles
Xerox OPBU
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top