Chapter 8. Tk GUI Programming with Tcl/Tk

In this chapter, we will cover:

  • Creating a widget
  • Writing to the console
  • Window manager
  • Creating a window
  • Destroying a window
  • Creating a custom dialog

Introduction

Up to this point, we have exclusively used the Tcl shell and its command set. While this is a wonderful method for writing scripts and non-graphical programs, it fails to provide the end user with a Graphical User Interface (GUI) to interact with. To allow for the creation and control of GUI and window elements, Tcl includes the Graphical Tool Kit (Tk).

Tk is a platform-independent GUI framework included in the Tcl package. By using the native Tk widgets and applying the correct theme, the GUI elements can be made to assume the native look and feel of ...

Get Tcl/Tk 8.5 Programming Cookbook 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.