tkwait(n)

πŸ’… tkwait(n) β€” Tk Built-In Commands, but make it group-chat πŸ’…

okay bestie, welcome to the tkwait page from the Tk Built-In Commands manual. this command is literally the β€œwait for it…” of Tk: it hangs out until one specific thing happens, then returns. no extra actions, no drama. ✨


πŸŽ€ NAME πŸŽ€

tkwait β€” wait for variable to change or window to be destroyed. that’s the whole assignment, and it ate. πŸ’…

✨ SYNOPSIS ✨

tkwait variable name
tkwait visibility name
tkwait window name

🌸 DESCRIPTION 🌸

The tkwait command waits for one of several things to happen, then it returns without taking any other actions. The return value is always an empty string. 🫧

Here’s the vibe check on that first argument, bestie:

  • 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. 🫢
  • If the first argument is visibility (or any abbreviation of it), then the second argument is the name of a window, and tkwait waits for a change in its visibility state (as indicated by the arrival of a VisibilityNotify event). This form is typically used to wait for a newly-created window to appear on the screen before taking some action. πŸ‘€βœ¨
  • If the first argument is window (or any abbreviation of it), then the second argument is the name of a window, and the tkwait command waits 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. πŸ’…

While the tkwait command is waiting, it processes events in the normal fashion, so the application will continue to respond to user interactions. If an event handler invokes tkwait again, the nested call to tkwait must complete before the outer call can complete. yes, bestie: inner wait has to wrap up before the outer wait can finish β€” nested-call rules, no cap. 😭🫢

πŸ”— SEE ALSO πŸ”—

🏷️ KEYWORDS 🏷️

  • variable
  • visibility
  • wait
  • window

sign-off: source/version is Tk, this page is tkwait(n), and the footer doesn’t print a date, so I’m not inventing one, bestie πŸ«ΆπŸ’–. go wait on your variables and windows responsibly β€” mwah πŸ’…βœ¨

πŸ“¦ where this page comes from