Navigation Logo List of Widget Types Navigation Logo

 

 

Tk has many built-in widget types. This chapter brings all of them together with a section for each one. Those widget types that are described in detail elsewhere are given a short overview here and are identified with a section title in italics.

All widget makers are invoked with this pattern:

widget_maker WIDGET_NAME ?OPTIONS?

where widget_maker is the name of the type of widget being made. The return string from executing this pattern is always the same as WIDGET_NAME. You control the nature of a widget with the available options.

Widgets are objects – each one has its own object action family whose actions are often called widget commands. What makes a widget unique are its options, object command family, and bindings to keystrokes and mouse events.

The particular widgets you create will get most of their own unique character from the values you give to their options. Some character will also come from bindings you create. Although Tcl does give you the power to redefine an object command family, this is not likely to be a wise thing to do.

Read these sections and do their exercises in any order you like. When you are done, try your skill at the four more complicated exercises in the last section.

  • Button
  • Canvas
  • Checkbutton
  • Entry
  • Frame
  • Label
  • Listbox
  • Menu and Menubutton
  • Message
  • Radiobutton
  • Scale
  • Scrollbar
  • Text
  • Toplevel
  • Exercises
  • Solutions to Exercises
 

 

[Sample TK Application]
Author's Home Page
Navigation Logo [Book's Cover]
Order from Amazon.