tkwait(3tk)
π tkwait β the Tk built-in that justβ¦ waits π
okay bestie, pull up a chair (or a beanbag, no judgement) because we're talking about tkwait, a Tk built-in command, and honestly? it's giving patient queen energy. β¨
β¨ NAME β¨
tkwait β wait for a variable to change, or for a window to be destroyed π¦
πΈ SYNOPSIS πΈ
tkwait variable name
tkwait visibility name
tkwait window name
π DESCRIPTION π
okay so. the tkwait command waits for one of several things to happen, and then it returns without taking any other actions. that's it. that's the whole job. it waits, and then it's done. main character who minds her own business. π
the return value is always an empty string. literally always. don't go looking for a payload, there isn't one, it's just vibes and an empty string. π
now let's break down the three forms, because the first argument is the whole personality here:
- if the first argument is
variable(or any abbreviation of it) β then the second argument is the name of a global variable, and the command waits for that variable to be modified. like, it's stalking the variable (affectionately). π - if the first argument is
visibility(or any abbreviation of it) β then the second argument is the name of a window, andtkwaitwaits for a change in its visibility state, as indicated by the arrival of aVisibilityNotifyevent. this form is typically used to wait for a newly-created window to appear on the screen before taking some action. so like, waiting for your friend to actually show up to the party before you start the group photo. π - if the first argument is
window(or any abbreviation of it) β then the second argument is the name of a window, andtkwaitwaits for that window to be destroyed. this form is typically used to wait for a user to finish interacting with a dialog box before using the result of that interaction. it's the "i'll wait until you're done clicking, bestie" form and honestly? respectful. π«Ά
π¦ while it's waiting π¦
while the tkwait command is waiting, it processes events in the normal fashion, so the application will continue to respond to user interactions. yes, the app is still alive, it's not frozen, breathe. π
and here's the lil twist: if an event handler invokes tkwait again, the nested call to tkwait must complete before the outer call can complete. nesting dolls. no skipping ahead. the inner one has to finish its sentence first. periodt. π
π SEE ALSO π
bind(3tk)vwait(3tk)
β KEYWORDS β
variable, visibility, wait, window
that's the whole page, bestie!! this one comes to you from Tk, filed under the page name tkwait(3tk), and ngl it was a delight. go wait on something. slay. π β¨π
π¦ where this page comes from
- debian trixie: tk9.0-doc 9.0.1-3
- ubuntu questing: tk9.0-doc 9.0.2-1
- ubuntu resolute: tk9.0-doc 9.0.3-1
- ubuntu stonking: tk9.0-doc 9.0.4-1
- Copyright (c) 1992 The Regents of the University of California
- Copyright (c) 1994-1996 Sun Microsystems, Inc
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms