|
发表于 2016-3-15 19:28:17
|
显示全部楼层
就不懂我看看呐NAME
2 B3 b5 R. ?- {" W+ |after - Execute a command after a time delay% R/ E( g( M5 X0 t: F# \
SYNOPSIS
. R- b* v; L" X- P9 B3 e" wafter ms+ _1 ^( c& Q0 i2 S: `! V0 k$ H$ j
after ms ?script script script ...?: X( e2 I! x/ k
after cancel id1 O* Q' X0 q; s5 Z- _# R. ^# x
after cancel script script script ...
7 a g3 ^ h/ u3 y+ l: Aafter idle ?script script script ...?1 N3 R& A) [6 D& ?( Z6 {/ v b
after info ?id?
7 k E4 D) U) {+ ?8 NDESCRIPTION
. ]! A* \2 j; }! g5 V% e, m/ B2 Tafter ms
2 g# Y6 _; r. \" q% gafter ms ?script script script ...?
* Q. W+ M. y" S( rafter cancel id
8 \5 p8 X# V) ]! c4 X% {after cancel script script ...
) W( J, i; J8 B5 }, W: q9 o2 n. I- cafter idle script ?script script ...?
. s5 d/ `' G. U6 Uafter info ?id?2 C" w/ M+ Z4 b9 D: H4 Y: f
SEE ALSO
& M9 D9 H5 d4 oKEYWORDS. v. s! I- L) Y! t% D
NAME4 ^1 m) z6 o8 d. W
) C" V6 E; A6 q- W! m& I# Safter - Execute a command after a time delay1 D4 R4 S% e, ~
SYNOPSIS
* h9 G3 T* a. k( R7 p
7 B& Q$ a! q I8 z! M. y/ s. e8 Eafter ms) X3 p" |. B) t. ^
after ms ?script script script ...?) o2 [$ v' q# g6 J
after cancel id3 `/ }, }% g: K0 w1 i) Z* l
after cancel script script script ...' \# p7 m: n. B" a& U0 F1 A# W
after idle ?script script script ...?7 I. k' M# x' w: w
after info ?id?
1 [) E* j: T$ `+ P- n2 ?DESCRIPTION
4 D5 l5 H# b# G% w3 G% G1 A2 P" Y( h" v8 K S* o
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:7 u" k! j! E) ]$ c; w
after ms, k/ I6 g$ l# v A3 U0 b
Ms 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.
0 K' ]1 D! U2 P' M2 J$ S- [& ~" Zafter ms ?script script script ...?. u5 _- z- }% `
In 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.
/ y& u+ E( h$ w {1 Q; \4 Xafter cancel id" P* N3 B- A) d/ |
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.% g) U! A! Y6 G3 ~0 A3 u( |
after cancel script script ...8 U4 E9 |' i6 _% w+ }
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.
* }( T s" O L, T. Qafter idle script ?script script ...?
, O% ?7 a4 V. C0 YConcatenates 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.& L, c, h9 b- V
after info ?id?
* A/ t4 b9 }4 ?' yThis 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./ ~& s. H. g! k( E4 I+ F
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. V, x; h/ T5 G+ K+ ]
! d5 P: M1 o3 t dSEE ALSO
1 Z- u: J6 ^5 ~! ^+ Q
8 A7 I5 b [' N9 M5 kbgerror
) ^; \6 u! |& l" @. RKEYWORDS4 a9 v* h2 g) p; N
# I9 B9 j! f; Y. [; C" ]
cancel, delay, idle callback, sleep, time/ E6 n. F1 n/ x) T
Copyright © 1990-1994 The Regents of the University of California.: s0 a' u% [: {, {! ?/ Z
Copyright © 1994-1996 Sun Microsystems, Inc.
7 Z; n+ [( g0 ~$ x% m5 o7 B, Y: Y$ VCopyright © 1995-1997 Roger E. Critchlow Jr. |
|