Artifacts Associated With Ticket 645964ffffffffffffffffffffffffffffffffff
Ticket change [df327776b6] (rid 114976) by petasis on 2002-11-30 06:25:51:
- assignee initialized to: "nijtmans"
- cmimetype initialized to: "text/plain"
- comment initialized to:
There seems to be an annoying problem with the "update idletasks" option of the update command. While this command is supposed to redraw windows, in the recent versions of tcl it does not. Consider for example the following small script: pack [label .x -text label] for {set i 0} {$i <= 100000} {incr i} { ## This will at least redraw the windows... .x configure -text "Count: $i" update idletasks } The behaviour of the above script is very strange. In my windows XP machine, the above script only updates the label widget (where its text changes) and the rest of the . window is not painted at all, showing the desktop part that was beneath the window at its creation time. If you move a window and pass it over the . window, it turns white, the label does not visually update any more and even when the computation is finished, the window remains white. You have to interact with the window (i.e. by moving it) to be drawn. - foundin initialized to: "obsolete: 8.4.1"
- priority initialized to: "5 Medium"
- resolution initialized to: "None"
- status initialized to: "Open"
- submitter initialized to: "petasis"
- subsystem initialized to: "02. Event Loops"
- title initialized to: ""update idle" fails to redraw tk windows"
- type initialized to: "Bug"
Ticket change [62c83d4da3] (rid 92464) by hobbs on 2002-12-01 03:58:47:
- closedate changed to: "2002-11-30T20:58:47"
- closer changed to: "hobbs"
- icomment:
Logged In: YES user_id=72656 update idle is doing exactly what you tell it to - only servicing the idle tasks. If you want the other behavior, use 'update' without any arguments.
- login: "hobbs"
- mimetype: "text/plain"
- resolution changed to: "Invalid"
- status changed to: "Closed"
- title changed to: ""update idle" fails to redraw tk windows"
- username: "hobbs"
Ticket change [01ab71381e] (rid 119518) by petasis on 2002-12-02 15:10:00:
- closedate changed to: "2002-12-02T08:10:00"
- closer changed to: "petasis"
- icomment:
Logged In: YES user_id=92283 Is it? According to the manual: "This causes operations that are normally deferred, such as display updates and window layout calculations, to be performed immediately." Are display updates done? Clearly no. Only partial updates (the label that changes) and this up to the point that you move a window over it. Then display update stops completelly (even the label that changes). Update in 8.3 displayed differently. I always had in mind that update idle handled all the "idle" events, including requests from the OS to redraw or move windows. Other input from the user (i.e. mouse clicks) were not processed. Now, with 8.4 update idle, no display events are processed and this causes problems under windows 2000 & XP. The app is marked as a non-responding one, and the OS may offer a window to kill it. Removing the idle parameter is not an exact alternative, as then input from the user is processed. You need a grab also to simulate how update idle worked in the past. I think that the update idle behaviour should be restored to what it used to be (I am not the only one who complains :-)) or to make clear that its behaviour has been changed in 8.4.
- login: "petasis"
- mimetype: "text/plain"
- title changed to: ""update idle" fails to redraw tk windows"
- username: "petasis"
Ticket change [ab662e3f40] (rid 101100) by dkf on 2002-12-02 20:59:00:
- closedate changed to: "2002-12-02T13:59:00"
- closer changed to: "dkf"
- icomment:
Logged In: YES user_id=79902 Redraws depend on not just Tk's internal state, but also the state of the windowing system and that can only get conveyed to us by way of events, and you need a full [update] for that to happen right. If you don't change the size (or position) of a window, you can count on [update idletasks] to do the redraw right (but geometry manager handling is something else again, especially with deeply nested windows) but in general you only see things up to date when you're servicing events fully. Note that you probably want to do that anyway, since otherwise you can miss out on redraw notifications due to the user popping another window on top of yours, and even some screensavers are interpreted as other windows...
- login: "dkf"
- mimetype: "text/plain"
- title changed to: ""update idle" fails to redraw tk windows"
- username: "dkf"
Ticket change [bc6f2f9b82] (rid 101749) by petasis on 2002-12-03 05:24:37:
- icomment:
Logged In: YES user_id=92283 But what is sad is that this behaviour has been recently adopted. There is a lot of code that assumes that update idle does a full visual update (as this is what the manual says) and arranges the widget layout. Now, update idle does not even draw windows in most of the situations. So what is now the purpose of calling update idle? For only executing scripts registered with after and calling variable traces? I think that now tk misses a procedure to draw its windows, fixing the widget layout, etc. but not process user input. (as update idle behaved in <= 8.4a2 :-)) Placing grabs & calling update may do the trick but I consider using grabs a problem by itself, as you can easily end up with a grab that was not released due to an error.
- login: "petasis"
- mimetype: "text/plain"
- title changed to: ""update idle" fails to redraw tk windows"
- username: "petasis"
- icomment:
Ticket change [ea54c6287e] (rid 103353) by petasis on 2002-12-03 05:24:38:
- closedate changed to: "2002-12-02T22:24:38"
- closer changed to: "petasis"
Ticket change [8a93b37472] (rid 127415) by hobbs on 2002-12-03 05:45:27:
- closedate changed to: "2002-12-02T22:45:27"
- closer changed to: "hobbs"
- icomment:
Logged In: YES user_id=72656 8.3.5 behaves the same as 8.4.1 on Win2K. I suspect this is either something unique to XP, or that perhaps your recollection of the previous behavior isn't quite right ;).
- login: "hobbs"
- mimetype: "text/plain"
- title changed to: ""update idle" fails to redraw tk windows"
- username: "hobbs"
Ticket change [77ba52c345] (rid 89821) by vincentdarley on 2002-12-03 18:05:28:
- closedate changed to: "2002-12-03T11:05:28"
- closer changed to: "vincentdarley"
- icomment:
Logged In: YES user_id=32170 I appreciate there may be some platform-limitations regarding this sort of behaviour, but as far as possible 'update idletasks' should ensure the gui is as fully updated as possible. Perhaps we need some caveat associated with toplevel window size changes, but I would assume that if the size of a toplevel doesn't change, Tk should be able to arrange for all internal widgets (including deeply nested ones) to be update. Currently it doesn't. The man page says: "The update idletasks command is useful in scripts where changes have been made to the application's state and you want those changes to appear on the display immediately, rather than waiting for the script to complete. Most display updates are performed as idle callbacks, so update idletasks will cause them to run. However, there are some kinds of updates that only happen in response to events, such as those triggered by window size changes; these updates will not occur in update idletasks." Under the common assumption that "window" = "toplevel window", Tk's behaviour does not agree with the above. (see e.g. bug 220776).
- login: "vincentdarley"
- mimetype: "text/plain"
- title changed to: ""update idle" fails to redraw tk windows"
- username: "vincentdarley"
Ticket change [8c3044ff66] (rid 127704) by petasis on 2002-12-03 20:15:15:
- closedate changed to: "2002-12-03T13:15:15"
- closer changed to: "petasis"
- icomment:
Logged In: YES user_id=92283 Yes but how 8.4a1 behaves? (8.3.5 may has back-ported various stuff, so I wouldn't consider it as an example) Perhaps its my fault (:-)) but it remains a fact that my app is now broken visually in many places under 8.4, where it ran fine in the past (i.e. one year ago). I use update idle in really many places in my code and simply now I end with not drawn windows, even when they haven't been moved or resized. Under windows & linux, so not an XP thing. I can fix this mess in my app, but this does not mean that everything is well with update idle. I still haven't understand what exactly update idle is supposed to do :-) And I agree with Vincent. We must have an update option that draws tk windows, but leaves events related to user input for processing with a full update.
- login: "petasis"
- mimetype: "text/plain"
- title changed to: ""update idle" fails to redraw tk windows"
- username: "petasis"
Ticket change [3864c44325] (rid 112202) by dkf on 2002-12-03 20:22:18:
- closedate changed to: "2002-12-03T13:22:18"
- closer changed to: "dkf"
- icomment:
Logged In: YES user_id=79902 Your expectations are wrong. Whenever you do [update idletasks], Tcl drains its queue of pending idle events, which includes internally-generated redraws of Tk windows. However, it processes no events from external sources, and cannot do because there is no easy way to tell what matters in that respect and what does not; window size and position changes are particularly tricky, and can be triggered by updates of content of other windows too. And this applies to both internal and toplevel windows; <Configure> event handlers make things tricky, and can be set on any window, and deeply nested collections of windows may take several rounds of [update idletasks] for them to be laid out correctly (in this case, it is because [update idletasks] does not process any idle event handlers registered by idle event handlers that are run during processing, which bounds the amount of work that may be done; if it didn't, Tk would have a trivial denial-of-service attack vulnerability.) The only way to guarantee a correct redraw of all windows is to regularly service the event queue fully (e.g. with [update], [vwait] or [tkwait].) If you don't do this, you cannot guarantee that all potentially pending redraws occur. End Of Story.
- login: "dkf"
- mimetype: "text/plain"
- title changed to: "[update idle] fails to redraw tk windows"
- username: "dkf"
Ticket change [f4e64b8a64] (rid 130008) by vincentdarley on 2002-12-03 20:54:16:
- closedate changed to: "2002-12-03T13:54:16"
- closer changed to: "vincentdarley"
- icomment:
Logged In: YES user_id=32170 In that case, the documentation for 'update idle' needs to be changed to reflect what you describe, in particular your image of "draining the idle event queue" is quite absent from the documentation! Also 'window size changes' needs to be replaced by 'any widget size changes', and perhaps any other common problems should be added to the list. From what you describe, if 'update idletasks' returned some information about whether there are any new idle events pending, this could be implemented in Tcl (and the possibility of a d.o.s. problem would then have to be dealt with in Tcl), for example: proc updateAllIdle {{iterations 10}} { while {[set res [update idletasks]]} { incr iterations -1 if {$iterations == 0} { return $res } } return $res } I am disturbed by George's report of all this changing in newer versions of Tk, however. - login: "vincentdarley"
- mimetype: "text/plain"
- username: "vincentdarley"
Ticket change [61c16f6081] (rid 92302) by dkf on 2002-12-05 16:47:23:
- closedate changed to: "2002-12-05T09:47:23"
- closer changed to: "dkf"
- icomment:
Logged In: YES user_id=79902 Currently, Tk does as much as it can without the full event loop firing when you do [update idletasks]. That it isn't as much as you would like is rather sad, but the way things are anyway; altering things so that all updates within a window occur correctly when [update idletasks] is done would break things a lot more, especially the separation between Tcl and Tk. (And what about code that sets a <Configure> event handler on an internal window and redraws itself in response to that? I've seen such stuff in operation - I've written and used such stuff! - and there's no way that that would behave "correctly" without full event loop servicing. And anyway, the manpage you quoted does mention that not all updates will happen correctly without full [update] and it is also specifically not normative about what won't happen. The docs are right, and the behaviour is unchangable; if things aren't happening quite right, that's just the platform-specific-ness biting you, but there's not much anyone can do about that, especially if the system widgets require full [update] to function correctly.)
- login: "dkf"
- mimetype: "text/plain"
- title changed to: ""update idle" fails to redraw tk windows"
- username: "dkf"