Chapter 11. Using Tcl Built-in Dialog Windows

In this chapter, we will cover:

  • Displaying a message box
  • Displaying a confirmation dialog
  • Displaying the color picker
  • Displaying the directory dialog
  • Displaying the file selection dialog
  • Selecting a directory and file

Introduction

Thankfully, we are not limited to dialog windows of our own creation. Tk provides a full suite of predefined dialog windows to assist us in the more common tasks of collecting, notifying, and general interactions with the end user. These dialog windows allow us to rapidly create an interface that is both professional in appearance and familiar in functionality with minimum effort. As with all Tk-based windows, the appearance of the native OS is duplicated automatically.

Although you are displaying a full graphical window, the dialog windows are invoked in the same manner as a Tcl command. As such, to assign the return values from the various dialog windows to a variable, you must utilize the set command in conjunction with the dialog commands.

Unless otherwise stated, we will need to access wish from the command line to complete the following examples. Launch the wish shell appropriately for your operating system and follow the instructions provided in each section.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.133.157.142