## Tcl8.6.17/Tk8.6.17 Documentation > Tcl Commands > update

### Tcl/Tk Applications | Tcl Commands | Tk Commands | [incr Tcl] Package Commands | SQLite3 Package Commands | TDBC Package Commands | tdbc::mysql Package Commands | tdbc::odbc Package Commands | tdbc::postgres Package Commands | tdbc::sqlite3 Package Commands | Thread Package Commands | Tcl C API | Tk C API | [incr Tcl] Package C API | TDBC Package C API

### NAME

update — 保留中の行事と無為状態の呼戻しを処理する Process pending events and idle callbacks

### 構文 SYNOPSIS

update ?idletasks?

### 説明 DESCRIPTION

この命令は､保留中の全ての行事(無為状態の呼戻しを含む)が処理される迄行事待ち行列に繰返し入ることにより､応用譜に “最新性” をもたらす為に使われる｡ This command is used to bring the application “up to date” by entering the event loop repeatedly until all pending events (including idle callbacks) have been processed.

もし idletasks 鍵語が命令の引数に指定されていると､新しい行事や不都合は処理されない; 無為状態の呼戻しのみが起動される｡これにより､画面の刷新や窓の割付の計算の様な通常猶予される操作がすぐさま遂行される｡ If the idletasks keyword is specified as an argument to the command, then no new events or errors are processed; only idle callbacks are invoked. This causes operations that are normally deferred, such as display updates and window layout calculations, to be performed immediately.

この update idletasks 命令は､応用譜の状態に変化がなされ､記述譜が終了するのを待つことなく直にその様な変化が画面に現れるべき記述譜の中では便利である｡殆どの画面の更新は無為状態の呼戻しとして遂行されので､ update idletasks はそれを実行させることになる｡しかし､譬えば窓の寸法の変更により起動される様な､行事に対する応答によってのみ生ずるような､幾つかの種類の更新があり､このような更新はupdate idletasks ではおこらない｡ 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.

指示項目なしの update 命令は､長期間の計算を実行するが､応用譜に使用者との対話のような行事に応答することを望む場合に便利である; 其処では､ もし､時折 update を呼出すと使用者の入力が次の update 呼出しの間に処理される様な､記述譜の中では便利である｡ The update command with no options is useful in scripts where you are performing a long-running computation but you still want the application to respond to events such as user interactions; if you occasionally call update then user input will be processed during the next call to update.

### 用例 EXAMPLE

計算機を約１秒走らせて終る: Run computations for about a second and then finish:

    set x 1000
    set done 0
    after 1000 set done 1
    while {!$done} {
        # 窮めて馬鹿げた実施例!
        # A very silly example!
        set x [expr {log($x) ** 2.8}]

        # 設定した期限切れが生じたかを調べてみる｡これは
        # 電網受け口に役立つ機会を与える､もし
        # Tk梱包が組込まれていると､使用者との対話動作も更新する｡
        # Test to see if our time-limit has been hit.  This would
        # also give a chance for serving network sockets and, if
        # the Tk package is loaded, updating a user interface.
        update
    }

### SEE ALSO

after, interp

### KEYWORDS

asynchronous I/O, event, flush, handler, idle, update
Copyright © 1990-1992 The Regents of the University of California.
Copyright © 1994-1996 Sun Microsystems, Inc.