Simple Widgets

You can download the code examples here.

What are the basic components of a GUI application? To a certain degree, every application provides

A well-thought-out application should be intuitive, in that its basic purpose and use should be apparent, or at least easily discovered. This goal can be realized through the strategic use of various widgets. The core Tk distribution comes packaged with some basic widgets that most applications make use of - some will be familiar to those of you who've had experience in making forms in CGI scripts, but others are unique to a Tk context. In this chapter we will be examining some simple widgets: buttons, labels, checkbuttons, radiobuttons, scales, entries, text entries, scrollable widgets, hlists, menubuttons, menus, dialogue boxes, balloons, numerical entries, progress bars, widgets used to open and save files, and the text and canvas widgets. A widget is generally created as
my $widget = $mw->WidgetName( [ option => value ] );
where $mw is the parent window. The options can be specified at the time the widget is created, or later using the configure method:
my $widget = $mw->WidgetName( [ option => value ] );
$widget->configure( [ option => value ]);
There are many options associated with each widget, but we will only highlight the minimum number here in order to see the basic usage and to provide a quick overview of what's available. A complete listing of the available options is given in an Appendix. The descriptions of these options are obtained from the Tk docuementation at the present time - you should consult your local documentation for these widgets for any changes or enhancements that may have since occurred.

Randy Kobes 2003-11-17