Creating an address book interface
In the following example, we will create an address book interface containing button, entry, label, and frame widgets. This will be the basis for the final application and illustrate how to use the grid
and pack
commands to create a more complex layout. The interface design is as follows:
Column 0 |
Column 1 |
Column 2 |
Column 3 | |||
Row 0 |
First Name Entry |
Last Name Entry |
Photo Label | |||
Row 1 |
First Name Label |
Last Name Label | ||||
Row 2 |
Address Entry | |||||
Row 3 |
Address Label | |||||
Row 4 |
City Entry |
State Entry |
Zip Entry | |||
Row 5 |
City Label |
State Label |
Zip Label | |||
Row 6 |
Phone Entry | |||||
Row 7 |
Phone Label |
Photo Label | ||||
Row 8 |
Previous Button |
Next Button | ||||
Row 9 |
Add Button |
Save Button |
Delete Button |
Exit Button |
Getting ready
To complete the following example, open the text editor of your choice and enter the following text. Then save the file in your path with the name address_book.tcl
.
# Load the Tk Package package require Tk...