1update(n) Tcl Built-In Commands update(n)
2
3
4
5______________________________________________________________________________
6
8 update - Process pending events and idle callbacks
9
11 update ?idletasks?
12______________________________________________________________________________
13
15 This command is used to bring the application “up to date” by entering
16 the event loop repeatedly until all pending events (including idle
17 callbacks) have been processed.
18
19 If the idletasks keyword is specified as an argument to the command,
20 then no new events or errors are processed; only idle callbacks are
21 invoked. This causes operations that are normally deferred, such as
22 display updates and window layout calculations, to be performed immedi‐
23 ately.
24
25 The update idletasks command is useful in scripts where changes have
26 been made to the application's state and you want those changes to
27 appear on the display immediately, rather than waiting for the script
28 to complete. Most display updates are performed as idle callbacks, so
29 update idletasks will cause them to run. However, there are some kinds
30 of updates that only happen in response to events, such as those trig‐
31 gered by window size changes; these updates will not occur in update
32 idletasks.
33
34 The update command with no options is useful in scripts where you are
35 performing a long-running computation but you still want the applica‐
36 tion to respond to events such as user interactions; if you occasion‐
37 ally call update then user input will be processed during the next call
38 to update.
39
41 Run computations for about a second and then finish:
42
43 set x 1000
44 set done 0
45 after 1000 set done 1
46 while {!$done} {
47 # A very silly example!
48 set x [expr {log($x) ** 2.8}]
49
50 # Test to see if our time-limit has been hit. This would
51 # also give a chance for serving network sockets and, if
52 # the Tk package is loaded, updating a user interface.
53 update
54 }
55
57 after(n), interp(n)
58
60 asynchronous I/O, event, flush, handler, idle, update
61
62
63
64Tcl 7.5 update(n)