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
14
16 This command is used to bring the application “up to date” by entering
17 the event loop repeatedly until all pending events (including idle
18 callbacks) have been processed.
19
20 If the idletasks keyword is specified as an argument to the command,
21 then no new events or errors are processed; only idle callbacks are
22 invoked. This causes operations that are normally deferred, such as
23 display updates and window layout calculations, to be performed immedi‐
24 ately.
25
26 The update idletasks command is useful in scripts where changes have
27 been made to the application's state and you want those changes to
28 appear on the display immediately, rather than waiting for the script
29 to complete. Most display updates are performed as idle callbacks, so
30 update idletasks will cause them to run. However, there are some kinds
31 of updates that only happen in response to events, such as those trig‐
32 gered by window size changes; these updates will not occur in update
33 idletasks.
34
35 The update command with no options is useful in scripts where you are
36 performing a long-running computation but you still want the applica‐
37 tion to respond to events such as user interactions; if you occasion‐
38 ally call update then user input will be processed during the next call
39 to update.
40
42 Run computations for about a second and then finish:
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
56
58 after(n), interp(n)
59
60
62 event, flush, handler, idle, update
63
64
65
66Tcl 7.5 update(n)