next up previous index
Next: Geometry Manager Up: Basic Tk Previous: Widget Types

Hello World Example

The "Hello World" example is very simple in Tk:

lyra% wish
% button .b -text "Hello World" -command exit
.b
% pack .b
%

The first command creates a button with the name .b and the label Hello World displayed on it. It also specifies that when the button is clicked on, the command exit is executed. Only when the pack   command is executed, the button appears on the screen, though:

On the display, we see the image of the button. The button is active, if we move the cursor inside it, the button changes its background colour to show that it responds to some events. When we click on the button, the window disappears and wish exits.



Micha Meier
Tue Jul 2 09:49:39 MET DST 1996