Index
Symbols
,(comma), 6
-(minus sign), 36-37
=>, 6
^, 36
A
accelerators, 231
activate method, 150
activating scrollbar elements, 136
add method, 243-244
adding text, 197
AddItems method, 227, 234
addtag method, 201
Advertice method, 285
after method, 306
afterCancel method, 307
afterIdle method, 297, 307
aligning text, 178
all tag, 199
allocation rectangle, 22-28
expanding,19, 25
filling, 19, 24
Alt key, 274
anchoring widgets
allocation rectangle, 27
basic button, 58
bitmap item, 190
checkbutton, 83
createWindow method, 198
image item, 191
label, 103
menubutton widget, 222
overview, 52
pack, 19
place, 48
radiobutton, 96
text item, 195
anonymous subroutines, 63
appearance, widget (see style)
application
grid, 267
name, 265, 295
applications, communicating among, 304
appname method, 295
arcs
arrows
line item, 191
scrollbar, 132
aspect method, 262
assigning callbacks (see callbacks, assigning)
atom, 300
(see also widgets, name)
atom method, 300
atomname method, 300
automatic window resizing, 32
B
background color (see color, options)
basic button
anchoring, 58
basic button (continued)
anonymous subroutines, 63
border width, 58
callbacks, 58, 62-64
color options, 58-59, 72-74
configuring, 79
creating, 57
cursor options, 58
disabling, 64
displaying
images, 59, 61
text, 60, 66
flashing, 79
focus, 59
font, setting, 58, 66
height, 59
invoking, 79
keyboard mapping, 72
naming conventions, 12
option list, 58-60
padding, 59
relief, 59
size, 70
state, 59
style, 68
text
justification, 59
wrapping, 60
underlining characters, 59
variable options, 59
width, 60
bbox method
canvas widget, 183, 202
listbox, 151
text widget, 173
bell method, 300
bind method, 270-272
canvas widget, 184
label widget, 107
listbox, 152
uses, 280
using with text tags, 168
valid argument list, 271
binding
events, 270-280
items using tags, 201
bindtags method, 280
bisque method, 293
bitmap
creating, 189
displaying
bitmap item, 190
checkbutton, 84
label widget, 103
menubutton widget, 222
radiobutton, 96
item option list, 189
options, 190
setting name and location, 58
(see also image)
border width
basic button, 58
canvas widget, 186
checkbutton, 84
entry widget, 109
frame widget, 252
label widget, 104
listbox, 143
menu widget, 239-240
menubutton widget, 222
radiobutton, 96
scale widget, 211
scrollbar, 129
text
tags, 164
widget, 155
toplevel widget, 258
bounding box, 151
(see also bbox method)
browse mode, listbox, 144
buffering, space, 38
Button method, 57
button (see basic button, checkbutton, or radiobutton)
ButtonPress event, 276
ButtonRelease event, 276
C
callbacks
arguments sent back, 272
assigning
basic button, 58, 62-64
canvas widget, 187
checkbutton, 83-84, 87
entry widget, 111
menu widget, 239, 241
radiobutton, 96
scale widget, 211, 213
scrollbar, 130, 133
selection, 301
text widget, 157
bind method, 272
stop processing, 279
(see also subroutine)
Camel book, 64
(see also Programming Perl)
Canvas method, 182
canvas widget, 181-209
adding text, 194
arc item, 188
bind method, using, 184
binding, 201
bitmap item, 190
bounding box coordinates, 202
callbacks, assigning, 187
color options, 186-187
configuring, 198
coordinate system, 182
creating
bitmaps, 189
canvas, 181
items, 188
cursor options, 186
deleting
items, 203
tags, 204
display list, changing, 203
example, 206
focus, setting, 187, 204
height, 186
indexes, text item, 196
inserting other widgets in, 197
item type, determining, 204
items, moving, 202
line item, 191
option list, 184-187
oval item, 193
polygon item, 194
rectangle item, 194
relief, 187
scaling, 205
scroll options, 187
scrollable region, 183
scrollbars with, 138
scrolling options, 185
tags, 199-201
text indexes with, 196
translating coordinates, 202
uses, 181
width, 187
canvasBind method, 184, 201
canvasx, canvasy methods, 202
Caps Lock key, 274
caret symbol, 36
cascade menu
adding, 235
item, 229
cascade method, 235
cascading menu, 247
cells method, 292
cget method
basic button, 79
canvas widget, 198
entry widget, 118
format, 311
frame widget, 256
label widget, 108
listbox, 147
menu widget, 243
menubutton widget, 233
optionmenu widget, 249
overview, 309
radiobutton, 100
scale widget, 216
scrollbar, 134
character spacing (see marks)
checkbutton, 81-93
anchoring, 83
bitmap, displaying, 84
border width, 84
callbacks, assigning, 84
color options, 83-85
configuring, 92
creating, 83, 234
cursor options, 84
flashing, 93
focus, 85
font, setting, 84
height, 84
checkbutton (continued)
image, displaying, 84, 90
indicator
color, setting, 89
displaying, 84
hiding, 89
storing status, 85
invoking, 93
on and off values, 88
option list, 83-85
overview, 81
relief, 85
state, 85
style, 91
text justification, 84
turning on and off, 93
underlining characters, 85
width, 85
with menubutton widget, 228
wrapping text, 85
Checkbutton method, 83
checkbutton method, 234
child widgets, 6, 290
children method, 290
circle tag, 199
Circulate event, 276
class method, 291
classes, with frame widget, 256
client method, 265
clipboard, manipulating, 300
clipboardAppend method, 300
clipboardClear method, 301
Cmd-Line method, 306
coding style, 8
color
basic button, 72-74
corruption, 255
depth, 253, 259, 292
highlight rectangle, 78
listbox, 145
options
arc item, 188
basic button, 58-59
bitmap item, 190
canvas widget, 186-187
checkbutton, 83, 85
entry widget, 109-110
frame widget, 252
label widget, 103-104
line item, 192
listbox widget, 143
menu widget, 239
menubutton widget, 222, 225
oval item, 193
postscript method, 204
radiobutton, 96-97
scale widget, 211-212
scrollbar, 129-130
text item, 195
text tags, 164
text widget, 155-157
toplevel widget, 258
scrollbar, 130
setting for application, 293
colormap
cell count, 292
determining if full, 292
options
frame widget, 252
postscript, 204
toplevel widget, 259, 266
problems, 255
Colormap event, 276
colormapfull method, 292
colormapwindows method, 266
columns
setting, 38
spanning, 37-38
(see also grid)
comma, 6
command method, 234, 266
command-line options, 306
communication among
applications, 304
widgets, 133
compare method, 173
composite widget, 281-289
advertise, calling, 285
alias, creating, 286
configure, calling, 286
creating based on a frame, 284
defining options, 287
delegates, calling, 286
example, 282
file location, 283
ConfigSpecs method, 286
Configure event, 276
configure method
basic button, 79
button widget, 313-314, 316-317, 319-323, 325, 327-329
canvas widget, 198, 312
checkbutton widget, 316
entry widget, 118, 317
format, 309
frame widget, 255-256, 319
label widget, 108, 320
listbox, 147
listbox widget, 321
menu widget, 243, 322
menubutton widget, 221, 233
optionmenu widget, 249
overview, 309
radiobutton, 100
radiobutton widget, 323
scale widget, 216, 325
scrollbar, 134
scrollbar widget, 327
text widget, 328
toplevel widget, 329
configuring
basic button, 79
canvas widget, 198
checkbutton, 92
entry widget, 118
label widget, 108
menu widget, 243
menubutton widget, 233
optionmenu widget, 248
radiobutton, 100
scale widget, 216
scrollbar, 127, 134
toplevel widget, 260
Construct method, 284
container
frame widget, 252
frames, 107
containing method, 297
Control key, 274
coordinate system, canvas widget, 182
coordinates
event, 278
setting, 48
translating, 202
coords method, 202, 216
counting items in a listbox, 150
createArc method, 188
createBitmap method, 189
createImage method, 190
createLine method, 191
createOval method, 193
createPolygon method, 194
createRectangle method, 194
createText method, 194
createWindow method, 197
creating
basic button, 57
canvas widget, 181
checkbutton, 83
entry widget, 109
frame widget, 251
label widget, 103
listbox, 141
menu widget, 238
menubutton, 220
optionmenu widget, 248
ovals, 193
polygons, 194
radiobutton, 94
rectangles, 194
scale widget, 210
scrollbar widget, 128
text widget, 154
toplevel widget, 257
widget, 6-7
current tag, 199
curselection method, 149
cursor
changing, 75
insert, 115, 119
options
basic button, 58
canvas widget, 186
checkbutton, 84
entry widget, 109-110
frame widget, 252
label widget, 104
menu widget, 239, 241
menubutton widget, 222
radiobutton, 97
scale widget, 211
scrollbar, 130
text widget, 156
toplevel widget, 259
cursor (continued)
positioning, 196
setting
listbox, 143
text widget, 155
D
databases, option, 293
dchars method, 196
debug function, 179
debugging code, 13, 179
defining event sequences, 273
deiconify method, 258, 262
delaying a program, 306
Delegates method, 286
delete method, 172
canvas widget, 203
entry widget, 118
listbox widget, 148
menu widget, 243-244
text widget, 172
deleting
items from
canvas widget, 203
listbox, 148
menu items, 244
tags, 204
text, 118, 172, 196
text tag, 170
delta method, 136
deltag method, 204
demo, widget, 72
depth method, 292
deselecting radiobuttons, 100
designing windows, 14
Destroy event, 276
destroy method, 302
destroy versus exit, 12
destroying widgets, 302
Dialog widget, 281
disabling buttons, 64
display list, changing, 203
displayed values, 214
displaying
menus, 245
widgets, 9
distances, screen, 295
dlineinfo method, 173
document list, dynamic, 236
double modifier, 274
dtag method, 204
dynamic document list, 236
E
embedding widgets, 176
enlarging widget, 38
Enter event, 276
entering passwords, 116
Entry method, 109
entry widget, 108-123
assigning content to a variable, 111
border width, 109
color options, 109-110
configuring, 118
creating, 109
cursor options, 109-110
deleting text, 118
determining contents, 119
focus, 111
font, setting, 110
indexes, 112-114
inserting text, 120
option list, 109-111
password entry, 116
relief, 110
relief options, 112
scrollbar use, 117
state, 110
text
justification, 110
selecting, 114
translating index values, 119
uses, 108
variable options, 111
width, 111
with
listbox, 152
scrollbars, 137
entrycget method, 233, 243
entryconfigure method, 234, 243
Ev method, 278
event
button number, 278
coordinates, 278
defined, 9
height, 279
keyboard information, 279
loop, 10
sequences, defining, 273
type, 275, 279
width, 279
Exists method, 295
exit versus destroy, 12
exiting the application, 12
expanding allocation rectangle, 19, 25
exporting text, 109
Expose event, 276
extended mode, listbox, 144
F
fileevent method, 305
filling
allocation rectangle, 19, 24
listbox, 141
find method, 201
finding tags, 201
flash method, 79, 93, 100
flashing
basic buttons, 79
checkbuttons, 93
radiobuttons, 100
focus
basic button, 59
canvas widget, 187
checkbutton, 85
entry widget, 111
frame widget, 253, 255
label widget, 104
listbox, 144
manipulating, 302
menu widget, 239
menubutton widget, 223
options, 77
radiobutton, 98
scale widget, 212
scrollbar, 130
setting, 204
text widget, 157
toplevel widget, 259, 267
focus method, 119, 204, 302
focusCurrent method, 303
focusFollowsMouse method, 303
focusForce method, 303
FocusIn event, 276
focusLast method, 303
focusmodel method, 267
FocusOut event, 276
font, setting
basic button, 58
checkbutton, 84
entry widget, 110
label widget, 104
listbox, 143
menu widget, 239-240
menubutton widget, 222
postscript method, 205
radiobutton, 97
scale widget, 211
text
item, 195
tags, 164
text widget, 156
font string, 334
fontActual method, 338
fontConfigure method, 338
fontCreate method, 334
fontDelete method, 338
fontFamilies method, 339
fontMeasure method, 338
fontMetrics method, 339
fontNames method, 339
fonts
configuring, 338
creating, 337
deleting, 338
families, 339
metrics, 339
specifying in buttons, 66
text widget, 157
Tk::Fonts module, 66
with Tk8.0 334
foreground color (see color, options)
fpixels method, 296
fraction method, 136
Frame method, 251
frame method, 267
frame widget, 251-256
adding a lable, 254
border width, 252
color options, 252
colormap
options, 252
problems, 255
creating, 251
cursor options, 252
defined, 7
fram widget (continued)
focus, 253, 255
height, 252
label, 252
option list, 252-253
relief, 253
style, 253
width, 253
frames, container, 107
functions
(see the individual method names)
G
geometry manager
deciding which to use, 56
overview, 9, 15
(see also pack, grid, and place)
geometry method, 260, 296
get method
entry widget, 111, 119
listbox, 148
scale widget, 216
scrollbar, 136
text widget, 172
getNames method, 175
Getopts modules, 306
gettags method, 201
GIF support, 61
grab method, 303
grabCurrent method, 304
grabGlobal method, 303
grabRelease method, 304
grabStatus method, 304
graphical user interface (see GUI)
graphics (see image)
Gravity event, 277
gravity, mark, 175
grid, 34-47
columns
setting, 38
spanning, 38
configuring columns and rows, 42
creating an empty cell, 37
determining widget location, 46
getting configuration information, 46
options, 38
padding widgets, 41
propagation, 46
removing widgets, 46
rows
setting, 38
spanning, 38
sizing text widget, 158
space buffer, 38
spanning columns/rows, 37, 39
special characters, 36
specifying rows and columns, 39
turning on or off, 143
grid method, 267
grid, setting, 157
gridColumnconfigure method, 43
gridForget method, 46
gridInfo method, 46
gridLocation method, 46
gridPropagate method, 46, 251
gridRowconfigure method, 43
gridSize method, 47
group method, 268
GUI
design considerations, 14
reasons to use, 2
H
hanging indent, 165
height
basic button, 59
button, 70
canvas widget, 186
checkbutton, 84
createWindow method, 198
event, 279
frame widget, 252
label widget, 104
listbox, 143
menubutton widget, 222
postscript method, 205
radiobutton, 97
setting, place, 48
text widget, 156
toplevel widget, 259
widget, specifying, 53
height method, 296
Hello World example
anonymous subroutine, 63
button in, 57
callbacks, 62
overview, 10-11
positioning widgets, 20
highlight rectangle, changing, 78
I
iconbitmap method, 263
iconify method, 263
iconmask method, 264
iconname method, 264
iconposition method, 264
inconwindow method, 264
icursor method, 119, 196
id method, 292
ID string, widget, 292
identify method, 137, 216
image
creating, 190
displaying
basic button, 59
checkbutton, 84
image item, 191
in a menu item, 232
in basic buttons, 61
in checkbuttons, 90
label widget, 104
menubutton widget, 223
radiobutton, 97
item, 191
indentation, setting, 165
index method
canvas widget, 196
entry widget, 119
listbox widget, 150
menu widget, 245
text widget, 172
indexes
bounding box, 151
comparing values, 173
entry widget, 112-114
listbox, 147
menu, 242
text, 196
text widget, 161-163
translating
into numerical equivalent, 150
values, 119, 172, 245
indicator
checkbutton, 89
color, 97
displaying, 84
options, menubutton widget, 223, 225
status, 97
status, storing, 85
insert cursor, 115, 119
(see also cursor, options)
insert method
canvas widget, 196-197
entry widget, 120
listbox, 147
menu widget, 244
text tag, 166
text widget, 155, 171
inserting
items in a listbox, 147
menu items, 244
text, 120, 171, 197
installing the Tk module, 5
invoke method, 79, 93, 100, 245
invoking
basic buttons, 79
checkbuttons, 93
menu items, 245
radiobuttons, 100
@ISA array, 282
ismapped method, 295
itemcget method, 199
itemconfigure method, 199
J
JPEG file support, 61
jump scroll, 130
justification, text
basic button, 59
checkbutton, 84
entry widget, 110
label widget, 104
menubutton widget, 223
radiobutton, 97
text
item, 195
tags, 165
widget, 160
K
keyboard
information, event, 279
mapping, 72
KeyPress event, 277
KeyRelease event, 277
L
Label method, 103
label widget, 102-10
anchoring, 103
bitmap, displaying, 103
border width, 104
color options, 103-104
configuring, 108
container frames, 107
creating, 103
cursor options, 104
focus, 104
height, 104
image, displaying, 104
option list, 103-105
padding, 104
relief options, 104-105
setting font, 104
status messages, 106
text
justification, 104
wrapping, 105
underlining characters, 104
uses, 103
variable options, 104
width, 105
labels
frame, 254
frame widget, 252
scale widget, 212, 214
LabEntry widget, 281-282
Leave event, 277
line
creating, 191
item options, 191
spacing, text widget, 157-158
listbox, 141-153
active versus selected, 150
border width, 143
color options, 143, 145
configuring, 147
counting items, 150
creating, 141
cursor, setting, 143
deleting items, 148
example script, 152
filling, 141
focus, setting, 144
font, setting, 143
height, 143
indexes, 147
inserting items, 147
options, 142
relief, 143
relief style, 146
resizing, 146
retrieving elements, 148
scolling methods, 151
scrollbar, assigning, 144
selection options, 144, 149-150
turning grid on or off, 143
width, 144
with
entry widget, 152
scrollbars, 138
Listbox method (see listbox)
listing widgets, 33
lower method, 203
M
MainLoop method, 257
MainLoop routine, 10-12
MainWindow class, 257
MainWindow method, 12, 15
MainWindow widget, 7
Map event, 277
mapping keys, 72
margin, setting, 165
markGravity method, 175
markNames method, 176
marks, 175-176
markSet method, 176
markUnset method, 176
$master, 46
maxsize method, 261
menu
displaying, 245
indexes, 242
uses, 218
Menu method, 238
menu method, 235
menu widget, 238-250
assigning callbacks, 239, 241
border width, 239-240
cascading menu, 247
color options, 239
configuring, 243
creating, 238
cursor options, 239, 241
deleting menu items, 244
example, 247
focus, setting, 239
font, setting, 239-240
indexes, translating values, 245
inserting menu items, 244
invoking menu items, 245
item type, determining, 245
option list, 239
relief, 239
style, 240
menubar, creating, 236
Menubutton method, 220
menubutton widget, 219-238
accelerators, 231
anchoring, 222
bitmap, displaying, 222
border width, 222
cascade menu, 235
cascade menu item, 229
checkbutton item, 228
color options, 222, 225
command item, 227
configuring, 233
creating, 220
cursor options, 222
examples, 236
focus, setting, 223
font, setting, 222
height, 222
image, displaying, 223
indicator options, 223, 225
items, adding, 234
option list, 221-224
padding, 223
radiobutton, 235
radiobutton item, 227
relief, 223
separator, 235
separator item, 231
state, 223
text
justification, 223
wrapping, 224
underlining characters, 224
width, 224
Meta key, 275
methods (see the individual method names)
metrics, font, 339
minsize method, 261
minus sign, 36-37
modifier, 273
modules, Perl/Tk
Getopts, 306
Tk::Dialog, 257
Motion event, 277
mouse cursor, changing, 75
move method, 202
moving items, canvas widget, 202
multiple mode, listbox, 145
N
name
application, 265, 295
widget, determining, 291
name method, 291, 300
naming conventions, widget, 12
nearest method, 151
new method, 257
next method, 303
O
offsetting text, 165
on and off values
checkbuttons, 88
radiobuttons, 98
OnDestroy method, 305
operating system differences, 145, 331-333
option databases, 293
Optionmenu method, 248
optionmenu widget, 248-249
configuring, 248
creating, 248
overview, 281
ordering widgets, 29
organizing widgets (see geometry manager)
orientation
scale widget, 212-213
scrollbar, 130
oval item options, 193-194
ovals, creating, 193
overrideredirect method, 268
overstrike, 165
owner, determining, 302
P
pack, 16-34
allocation rectangles, 22-28
anchoring widgets, 19, 27
automatic resizing, 32
getting configuration information, 32
listing widgets, 33
option list, 19
ordering widgets, 29
overview, 9
packing order, 19
padding widgets, 19, 29
positioning widgets, 20
screen distances, 31
sizing text widget, 158
unpacking widgets, 32
with frame widget, 251
packForget method, 32
packInfo method, 32
packing order, 19
packPropagate method, 32, 108, 251
packSlaves method, 33
padding
basic button, 59
label widget, 104
menubutton widget, 223
text widget, 156
widgets, 19, 29
window method, 178
parent method, 291
parent widgets
determining, 291
overview, 6
with frames, 251
password entries, 116
pathname method, 292
pathname, widget, 292
Perl
history, 1
reference, general, x
Tk extension (see Perl/Tk)
Perl/Tk
coding style, 8
debugging a program, 13
fonts, 334
Getopts modules, 306
history, 1
installing, 1, 5
modules (see modules, Perl/Tk), 257
quiting, 12
reasons to use, 3
Tk::Fonts module, 66
using in Perl scripts, 1
versions, 2
with
Unix, 331
Windows, 332
Photo method, 61
pictures (see image)
pixels method, 295
place, 47-56
absolute coordinates, 49
anchoring widgets, 52
getting configuration information, 55
options, 48
relative coordinates, 50
specifying height and width, 53
placeForget method, 55
placeInfo method, 55
placSlaves method, 55
placing widgets (see place)
pointerx, pointery, pointerxy methods, 298
polygons, creating, 194
Popup method, 245
positionfrom method, 268
positioning
cursor, 196
widgets, 20, 22, 297
(see also pack)
post method, 218, 245
postcascade method, 247
postscript method, 204
PostScript output, canvas widget, 204
PPM/PGM file support, 61
prev method, 303
print, printf, 13
Programming Perl, 64, 282, 306
protocol method, 265
Q
Quick Draw program, 207
quitting an application, 12
R
radiobutton, 93-100
anchoring, 96
assigning callbacks, 96
bitmap, displaying, 96
border width, 96
color options, 96-97
configuring, 100
creating, 94
cursor options, 97
flashing, 100
focus, 98
font, setting, 97
height, 97
highlight rectangle, 97
indicator
color, 97
status, 97
invoking, 100
menubutton widget, 235
on and off values, 98
option list, 96-98
overview, 81
relief, 97
selecting and deselecting, 100
state, 98
style, 99
text justification, 97
underlining characters, 98
variable options, 98
width, 98
with menubutton widget, 227
wrapping, text, 98
Radiobutton method, 95
radiobutton method, 235
raise method, 203, 258
range of values, scale widget, 213
rectangle
allocation (see allocation rectangle)
creating, 194
highlight, 78, 97
relief
canvas widget, 187
checkbutton, 85
entry widget, 110
frame widget, 253
label widget, 104
listbox, 143
menu widget, 239
menubutton widget, 223
options
basic button, 59
entry widget, 112
label widget, 105
listbox, 146
radiobutton, 97
scale widget, 212
scrollbar, 129-130
text
tags, 165
widget, 156
toplevel widget, 259
removing widgets, 46, 55
Reparent event, 278
repeat method, 307
reqheight method, 296
reqwidth method, 296
resizable method, 261
resizing
listbox, 14
window, automatic, 32
retrieving elements from a listbox, 148
rgb method, 293
RGB value, 293
right-click menu example, 247
rootx, rooty method, 297
rows
setting, 38
spanning, 38
(see also grid)
S
Scale method, 206, 210
scale widget, 210-217
assigning callbacks, 211
border width, 211
changing size, 215
color options, 211-212
configuring, 216
creating, 210
cursor options, 211
determining coordinates, 216
focus, setting, 212
font, setting, 211
identifying parts, 216
label options, 212, 214
option list, 211-212
orientation, 212-213
range of values, 213
relief, 212
setting value, 216
slider options, 212
scale widget (continued)
state, 212
uses, 210
value increments, displaying, 214
variable options, 212
width, 212
scaling the canvas widget, 205
scan method, 152
scanDragto method, 121, 179, 206
scanMark method, 121, 179, 206
scanning
canvas, 206
text, 121
screen
distances
converting, 295
units, 31
information, 298
screen method, 298
screencells method, 299
screendepth method, 299
screenheight method, 298
screenvisual method, 299
screenwidth method, 298
scrollable region, canvas widget, 183
scrollbar, 124-140
activating elements, 136
arrows, 132
assigning callbacks, 130, 133
border width, 129
color options, 129-130
communicating with other widgets, 133
configuring, 127, 134
creating, 128
cursor options, 130
defining, 124, 135
examples, 137
focus, setting, 130
option list, 129-130
orientation, 130
relief, 129-130
slider, 132
style, 131
using one with multiple widgets, 138
width, 130
with
entry widget, 117, 137
listbox, text, or canvas widgets, 138
scrollbar, assigning to widget, 144
Scrollbar method, 128
Scrolled method
canvas widget, 181, 184, 203
scrollbar widget, 125-128
scrolling
canvas widget, 206
listbox, 151
text, 121
search method, 174
searching text widget, 174
see method, 150, 173
sel tag, 164, 167
selectClear method, 197
select From method, 197
selecting
items in a listbox, 144
radiobutton, 100
text
canvas widget, 197
entry widget, 114
selection
method, 121, 149
mode, 143
options, listbox, 149-150
selectionAnchor method, 150
Selection Clear method, 301
selectionClear method, 149
SelectionGet method, 301
SelectionHandle method, 301
SelectionIncludes method, 149
SelectionOwn method, 302
selectionOwner method, 302
selectionPresent method, 122
selectionRange method, 122
selectionSet method, 149
selectionTo method, 122
selectTo method, 197
send method, 304
separator, creating, 235
separator item, 231
separator method, 235
server method, 300
server type, 300
set method, 135, 216setPalette method, 293
setting tab stops, 159
Shift key, 274
single mode, listbox, 144size method, 150
size, widget, 296
sizefrom method, 269
sizing
text widget, 158
toplevel widget, 260
widgets (see pack)
slider
scale widget, 212
scrollbar, 132
spacing
character (see marks)
line, 157-158
spanning rows and columns, 39
state
basic button, 59
checkbutton, 85
entry widget, 110
menubutton widget, 223
radiobutton, 98
scale widget, 212
toplevel widget, 265
status label, 106
stipple pattern
arc item, 189
line item, 192
oval item, 193
text item, 195
text tags, 164
stored values, 214
storing indicator status, 85
style
basic button, 68
checkbutton, 91
frame widget, 253
menu widget, 240
radiobutton, 99
scrollbar, 131
subroutine
anonymous, 63
references, 64
(see also callbacks)
Subwidget method, 184
SUPER::bind, 184
SUPER::Populate, 285
switches, search method, 174
syntax
options, 6
screen distances, 31
T
tab stops, setting, 159
tabs, setting, 157, 165
tag names
arc item, 189
bitmap item, 190
create Window method, 198
image item, 191
line item, 193
oval item, 193
text item, 195
tagAdd method, 166, 168
tagBind method, 169
tagCget method, 168
tagConfigure method, 167, 172
tagDelete method, 170
tagLower method, 170
tagNames method, 171
tagNextrange method, 171
tagRaise method, 170
tagRanges method, 171
tagRemove method, 170
tags
canvas widget, 199-201
finding, 201
text, 164-171
Tcl/Tk, 1, 4
tear-off items, 224
text
adding, 197
deleting, 118, 196
entering, 108
exporting, 109
in a canvas widget, 194
indexes, 196
inserting, 120, 171
item indexes, 196
justification (see justification, text)
scanning, 121
scrolling, 121
selecting, 197
selection options, entry widget, 114
tags, 164-171
adding to existing text, 168
border width, 164
changing priority, 170
color options, 164
configuring, 167
creating, 167
text, tags (continued)
deleting, 170
example, 166
font, setting, 164
justification, text, 165
option list, 164-165
relief, 165
removing tag from text, 170
stipple pattern, 164
underlining characters, 165
using bind method, 168
wrapping, text, 165
widget, 154-180
assigning callbacks, 157
border width, 155
changing appearance, 164
color options, 155-157
creating, 154
cursor options, 156
cursor , setting, 155
debugging, 179
deleting text, 172
embedding other widgets, 176
example, 160
font, setting, 156
font use, 157
grid, setting, 157
height, 156
indexes, 161-163
inserting text, 171
justification values, 160
line spacing, 157-158
marks, 175-176
option list, 155-157
padding, 156
relief, 156
scrollbars with, 138
searching contents, 174
setting tab stops, 159
sizing, 158
state, 157
tabs, 157
tag, 166
uses, 154
width, 157
wrapping (see wrapping, text)
Text method, 154
time delays, 306
title method, 11, 262
Tk clipboard, manipulating, 300
Tk (see Perl/Tk)
Tk::bind, 184, 201
Tk::break, 279
Tk::Button, 280
Tk::Dialog, 257
Tk::Fonts module, 66
Tk::Frame, 284
Tk::JPEG, 61
Tk::Widget, 284
Toplevel method, 257
toplevel method, 291
toplevel widget, 257-269
application grid, 267
border width, 258
color options, 258
colormap options, 259, 266
command property, 266
configuring, 260
creating, 257
cursor options, 259
defined, 7
focus model, 267
focus, setting, 259
height, 259
icon
bitmap, 263
mask, 264
name, 264
position, 264
option list, 258-259
relief, 259
setting title, 262
sizing, 260
state, 265
uses, 257
width, 259
window properties, 265
transient method, 269
translating to RGB value, 293
triple modifier, 275
type method, 204, 245
U
underlining characters
basic button, 59
checkbutton, 85
label widget, 104
menubutton widget, 224
radiobutton, 98
text tags, 165
Unix
color values, 73
fonts, 66
using Perl/Tk with, 331
Unmap event, 278
unpacking widgets, 32
unpost method, 247
update method, 297
V
value
displayed versus stored, 214
increments, scale widget, 214
range, scale widget, 213
variable options
basic button, 59
entry widget, 111
label widget, 104
radiobutton, 98
scale widget, 212
versions of Perl/Tk, 2
viewable method, 300
virtual desktop, 297
Visibility event, 278
visualsavailable method, 299
vrootheight method, 298
vrootwidth method, 298
W
waitVariable method, 304
waitWindow method, 305
widget types
basic button, 57-80
canvas, 181-209
checkbutton, 81-93
composite, 281-289
entry, 108-123
frame, 251-256
label, 102-108
listbox, 141-153
MainWindow, 7
menu, 238-248
menubutton, 220-238
optionmenu, 248-249
radiobutton, 93-100
scale, 210-217
scrollbar, 124-140
text, 154-180
toplevel, 257-269
widgets
anchoring, 27, 52
checkbutton, 83
place, 48
children, determining, 290
creating, 6-7
demo with Tk module, 72
destroying, 302
displaying, 9
embedding, 176
enlarging, 38
height, setting, 48
item, 197
listing, 33
name, 291
(see also atom)
naming conventions, 12
ordering, 29
organizing (see geometry manager)
padding, 29, 41
parent and child, 6
parent, determining, 291
pathname, 292
placing (see place)
position, 297
positioning, 20, 22
(see also pack)
removing, 46, 55
resizing, automatic, 32
screen information, 298
size, determining, 296
sizing, 19
(see also pack)
space buffer, 38
specifying width and height, 53
unpacking, 32
width, setting, 48
Widgettype method, 6
width
arc item, 189
basic button, 60
button, 70
canvas widget, 187
checkbutton, 85
createWindow method, 198
entrywidget, 111
cover24213.jpg
About the Author
Nancy Walsh is a consultant for Sybase, Inc. She spent too many years at the University of Arizona, changing majors a multitude of times and finally ending up with a B. S. in computer science. Continuing on in life, she has worked mostly with Perl and Java in the last few years.
In the family tradition of not sitting still, Nancy has numerous hobbies, which include quilting (pieced and applique, hand and machine quilting), stained glass (anything that doesn't break yet), martial arts (she is approximately halfway to a black belt in Tae Kwon Do), amateur radio (QRP mostly), and reading (anything with words).
Colophon
Our look is the result of reader comments, our own experimentation, and feedback from distribution channels. Distinctive covers complement our distinctive approach to technical topics, breathing personality and life into potentially dry subjects.
The bird on the cover of Learning Perl/Tk is a juvenile emu (Dromaius novaebollandiae). This large, flightless bird is found throughout the Australian bush steppes. The emu is one of the largest birds in existence, second only to its cousin the ostrich. Adult emus stand about 5 feet (1.5 m) high and weigh up to 120 pounds (55 kg). The grayish-brown emu's small wings contain only six or seven feathers. They are hidden by the long, hairlike rump plumage. Emus have extremely strong legs, which they use as defensive and offensive weapons when fighting. A human limb can be broken by a kick from an emu. Their powerful legs make emus strong swimmers and fast runners; they can reach speeds of up to 50 km/hour.
Male emus, which are slightly smaller than the females, tend to the incubation of eggs and the raising of the young. An emu nest contains up to fifteen to twentyfive deep green eggs, laid by several hens. Incubation of the eggs takes from twenty-five to sixty days. The large discrepancy in incubation time occurs because the male needs to leave the nest periodically to find food and drink. The length of time he is away affects the time for incubation. Newly hatched emus weigh about 15 ounces (440 g). They are fully grown at two to three years.
The relationship between emus and Australian farmers has always been an adversarial one; three coastal subspecies of emu have been exterminated. Because emus can jump over high fences, it is difficult to keep them out of fields, where they eat
and trample crops. In the arid Australian bush, emus also compete with cattle and sheep for grass and water. On the other hand, emus eat many insects that would otherwise eat crops. In 1932 Australian farmers declared war on the emus, making an all-out effort to eradicate them. Fortunately, the effort failed. The battle between emus and farmers continues to this day.
Edie Freedman designed the cover of this book, using a 19th-century engraving from the Dover Pictorial Archive. Kathleen Wilson designed the back cover and produced the cover layout with QuarkXPress 3.32, using the ITC Garamond font.
The interior design was done by Edie Freedman and modified by Nancy Priest, using the ITC Garamond Light and Garamond Book fonts. The text was prepared in FrameMaker 5.5 by Mike Sierra. The illustrations were created by Robert Romano in Adobe Photoshop 5.0 and Macromedia Freehand 8.0. Quality assurance was provided by Ellie Fountain Maden, Jeffrey Liggett, Claire Cloutier LeBlanc, and Sheryl Avruch. This colophon was written by Clairemarie Fisher O'Leary. Editorial and production services were provided by TIPS Technical Publishing-copyediting by Judy Flynn, composition and indexing by Karen Brown of Scriptorium Publishing Services, Inc., proofreading by Rachel Anderson of Archer Editorial, and project management by Robert Kern.
Whenever possible, our books use a durable and flexible lay-flat binding, either RepKover(tm) or Otabind(tm). If the page count exceeds the maximum bulk possible for this type of binding, perfect binding is used.