|
发表于 2016-3-15 19:28:17
|
显示全部楼层
就不懂我看看呐NAME* T7 }/ z: `9 v& }. F" e
after - Execute a command after a time delay
! T3 }5 X3 r5 L a4 sSYNOPSIS
1 Y% m9 i9 f7 Q' }8 X) Safter ms
; q% A( g0 T' s. _- `" B9 @after ms ?script script script ...?" y7 h C) S' ]
after cancel id$ q U" r5 q+ X. [* o8 H6 N
after cancel script script script ...' Z: [! v4 a8 a) I$ ~0 n
after idle ?script script script ...?1 g1 O3 V8 r, f" L* o. J6 X
after info ?id?
) L% C5 \1 x& z ZDESCRIPTION
. G9 E1 p0 ~7 dafter ms6 w+ u% ?" } y
after ms ?script script script ...?
7 G3 t" F! p6 J$ G" s' mafter cancel id3 b# H0 N1 b+ \9 g5 P @+ {
after cancel script script ...3 |9 }: o: s& ]: F; @
after idle script ?script script ...?: R# J* v' C8 k& D* T- s3 z9 c
after info ?id?
7 m T, B Z" }# @1 D h0 f7 uSEE ALSO! ?/ @8 t3 g$ M3 R; D
KEYWORDS
9 v- N6 Q8 O! g$ A/ y, uNAME
+ W% L2 \# K8 Y1 f% V$ N. X* G6 o% `9 Y
after - Execute a command after a time delay8 I- o: E9 X2 { ?
SYNOPSIS5 c8 V* D6 V+ ^$ H' C5 w# }3 A4 h
+ L* d4 Y, Z& _- _4 C0 Vafter ms+ C6 O+ L8 g. T; k5 {6 v
after ms ?script script script ...?
- C7 z& @0 g8 xafter cancel id
7 K, n1 g' Q! Uafter cancel script script script ...
- R8 w& f# l7 bafter idle ?script script script ...?
3 O. r3 H, s0 g6 B+ lafter info ?id?
$ Z0 Z/ C3 d0 {# ?& t7 C0 F7 j4 t- gDESCRIPTION
6 \. @# i7 S* d5 I5 L* L( Q) Z8 h- T$ X8 r# m
This command is used to delay execution of the program or to execute a command in background sometime in the future. It has several forms, depending on the first argument to the command:
& X' U8 F6 |" G+ w$ \after ms
E$ j1 Z" _1 a: f; Q# eMs must be an integer giving a time in milliseconds. The command sleeps for ms milliseconds and then returns. While the command is sleeping the application does not respond to events.
% I* L% Q- `$ v: W5 s. Wafter ms ?script script script ...?
# W; p2 R2 B" Q: M/ S* z* EIn this form the command returns immediately, but it arranges for a Tcl command to be executed ms milliseconds later as an event handler. The command will be executed exactly once, at the given time. The delayed command is formed by concatenating all the script arguments in the same fashion as the concat command. The command will be executed at global level (outside the context of any Tcl procedure). If an error occurs while executing the delayed command then the bgerror mechanism is used to report the error. The after command returns an identifier that can be used to cancel the delayed command using after cancel.
) p( z3 c) l+ uafter cancel id
% I8 o0 ]7 r2 u& V6 w _Cancels the execution of a delayed command that was previously scheduled. Id indicates which command should be canceled; it must have been the return value from a previous after command. If the command given by id has already been executed then the after cancel command has no effect.
2 I0 w- m* Y! g: w$ Vafter cancel script script ... \+ L* a+ S$ f" n0 \# u
This command also cancels the execution of a delayed command. The script arguments are concatenated together with space separators (just as in the concat command). If there is a pending command that matches the string, it is cancelled and will never be executed; if no such command is currently pending then the after cancel command has no effect.
6 l2 p+ {9 z. x( \1 f. Oafter idle script ?script script ...?
) L3 Y6 u/ a& W" r, E7 ?# f" MConcatenates the script arguments together with space separators (just as in the concat command), and arranges for the resulting script to be evaluated later as an idle callback. The script will be run exactly once, the next time the event loop is entered and there are no events to process. The command returns an identifier that can be used to cancel the delayed command using after cancel. If an error occurs while executing the script then the bgerror mechanism is used to report the error. @% e1 V1 [# Y) g! ?9 c
after info ?id?
* b7 R9 K7 Q# H2 t* CThis command returns information about existing event handlers. If no id argument is supplied, the command returns a list of the identifiers for all existing event handlers created by the after command for this interpreter. If id is supplied, it specifies an existing handler; id must have been the return value from some previous call to after and it must not have triggered yet or been cancelled. In this case the command returns a list with two elements. The first element of the list is the script associated with id, and the second element is either idle or timer to indicate what kind of event handler it is.9 V7 I# m0 b8 ^4 j7 E
The after ms and after idle forms of the command assume that the application is event driven: the delayed commands will not be executed unless the application enters the event loop. In applications that are not normally event-driven, such as tclsh, the event loop can be entered with the vwait and update commands.
! H1 y* ]2 ~3 a% y$ \' G3 q& |
8 G' q: p7 Q8 F! L9 J% i7 Q7 N+ y, @SEE ALSO( ^ f9 u9 B. j4 h0 U
; j9 L3 S4 b/ S* }0 `8 ]/ [
bgerror
7 t0 ?9 H0 @( SKEYWORDS; v+ D' x# ]4 e6 \3 x# A) u
. r- u3 S" H7 k: \3 ]2 ~cancel, delay, idle callback, sleep, time% c) C0 ?1 y% w9 ?+ o5 z
Copyright © 1990-1994 The Regents of the University of California.
0 m$ M, ?6 [& D4 i# J, Q# X1 ~Copyright © 1994-1996 Sun Microsystems, Inc.
; C; y% z: x0 ]( mCopyright © 1995-1997 Roger E. Critchlow Jr. |
|