Chapter 39. Focus, Grabs, and Dialogs

Dialog boxes are a standard part of any user interface. Several dialog boxes are built into Tk. This chapter also describes how to build dialogs from scratch, which involves keyboard focus and grabs. Input focus directs keyboard events to different widgets. The grab mechanism lets a widget capture the input focus. This chapter describes the focus, grab, tk_dialog, and tkwait commands. Tk 4.2 adds tk_getOpenFile, tk_getSaveFile, tk_chooseColor, and tk_messageBox. Tk 8.3 adds tk_chooseDirectory.

Dialog boxes are a common feature in a user interface. The application needs some user response before it can continue. A dialog box displays some information and some controls, and the user must interact with it before ...

Get Practical Programming in Tcl and Tk, Fourth Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.