| 1 |
# Copyright (c) 1992-1994 The Regents of the University of California. |
| 2 |
# Copyright (c) 1994-1996 Sun Microsystems, Inc. |
| 3 |
# See the file "license.terms" for information on usage and redistribution |
| 4 |
# of this file, and for a DISCLAIMER OF ALL WARRANTIES. |
| 5 |
# |
| 6 |
|
| 7 |
=head1 NAME |
| 8 |
|
| 9 |
Tk::Canvas - Create and manipulate Canvas widgets |
| 10 |
|
| 11 |
=for category Tk Widget Classes |
| 12 |
|
| 13 |
=head1 SYNOPSIS |
| 14 |
|
| 15 |
I<$canvas> = I<$parent>-E<gt>B<Canvas>(?I<options>?); |
| 16 |
|
| 17 |
=head1 STANDARD OPTIONS |
| 18 |
|
| 19 |
B<-background> B<-highlightthickness> B<-insertwidth> B<-state> |
| 20 |
B<-borderwidth> B<-insertbackground> B<-relief> B<-tile> |
| 21 |
B<-cursor> B<-insertborderwidth> B<-selectbackground> B<-takefocus> |
| 22 |
B<-highlightbackground> B<-insertofftime> B<-selectborderwidth> B<-xscrollcommand> |
| 23 |
B<-highlightcolor> B<-insertontime> B<-selectforeground> B<-yscrollcommand> |
| 24 |
|
| 25 |
=head1 WIDGET-SPECIFIC OPTIONS |
| 26 |
|
| 27 |
=over 4 |
| 28 |
|
| 29 |
=item Name: B<closeEnough> |
| 30 |
|
| 31 |
=item Class: B<CloseEnough> |
| 32 |
|
| 33 |
=item Switch: B<-closeenough> |
| 34 |
|
| 35 |
Specifies a floating-point value indicating how close the mouse cursor |
| 36 |
must be to an item before it is considered to be ``inside'' the item. |
| 37 |
Defaults to 1.0. |
| 38 |
|
| 39 |
=item Name: B<confine> |
| 40 |
|
| 41 |
=item Class: B<Confine> |
| 42 |
|
| 43 |
=item Switch: B<-confine> |
| 44 |
|
| 45 |
Specifies a boolean value that indicates whether or not it should be |
| 46 |
allowable to set the canvas's view outside the region defined by the |
| 47 |
B<scrollRegion> argument. |
| 48 |
Defaults to true, which means that the view will |
| 49 |
be constrained within the scroll region. |
| 50 |
|
| 51 |
=item Name: B<height> |
| 52 |
|
| 53 |
=item Class: B<Height> |
| 54 |
|
| 55 |
=item Switch: B<-height> |
| 56 |
|
| 57 |
Specifies a desired window height that the canvas widget should request from |
| 58 |
its geometry manager. The value may be specified in any |
| 59 |
of the forms described in the L<"COORDINATES"> section below. |
| 60 |
|
| 61 |
=item Name: B<scrollRegion> |
| 62 |
|
| 63 |
=item Class: B<ScrollRegion> |
| 64 |
|
| 65 |
=item Switch: B<-scrollregion> |
| 66 |
|
| 67 |
Specifies a list with four coordinates describing the left, top, right, and |
| 68 |
bottom coordinates of a rectangular region. |
| 69 |
This region is used for scrolling purposes and is considered to be |
| 70 |
the boundary of the information in the canvas. |
| 71 |
Each of the coordinates may be specified |
| 72 |
in any of the forms given in the L<"COORDINATES"> section below. |
| 73 |
|
| 74 |
=item Name: B<state> |
| 75 |
|
| 76 |
=item Class: B<State> |
| 77 |
|
| 78 |
=item Switch: B<-state> |
| 79 |
|
| 80 |
Modifies the default state of the canvas where I<state> may be set to one of: |
| 81 |
normal, disabled, or hidden. Individual canvas objects all have their own |
| 82 |
state option, which overrides the default state. Many options can take |
| 83 |
separate specifications such that the appearance of the item can be different |
| 84 |
in different situations. The options that start with "active" control the |
| •85 |
appearance when the mouse pointer is over it, while the option starting |
| 86 |
with "disabled" controls the appearance when the state is disabled. |
| 87 |
|
| 88 |
=item Name: B<width> |
| 89 |
|
| 90 |
=item Class: B<width> |
| 91 |
|
| 92 |
=item Switch: B<-width> |
| 93 |
|
| 94 |
Specifies a desired window width that the canvas widget should request from |
| 95 |
its geometry manager. The value may be specified in any |
| 96 |
of the forms described in the L<"COORDINATES"> section below. |
| 97 |
|
| 98 |
=item Name: B<xScrollIncrement> |
| 99 |
|
| 100 |
=item Class: B<ScrollIncrement> |
| 101 |
|
| 102 |
=item Switch: B<-xscrollincrement> |
| 103 |
|
| 104 |
Specifies an increment for horizontal scrolling, in any of the usual forms |
| 105 |
permitted for screen distances. If the value of this option is greater |
| 106 |
than zero, the horizontal view in the window will be constrained so that |
| 107 |
the canvas x coordinate at the left edge of the window is always an even |
| 108 |
multiple of B<xScrollIncrement>; furthermore, the units for scrolling |
| 109 |
(e.g., the change in view when the left and right arrows of a scrollbar |
| 110 |
are selected) will also be B<xScrollIncrement>. If the value of |
| 111 |
this option is less than or equal to zero, then horizontal scrolling |
| 112 |
is unconstrained. |
| 113 |
|
| 114 |
=item Name: B<yScrollIncrement> |
| 115 |
|
| 116 |
=item Class: B<ScrollIncrement> |
| 117 |
|
| 118 |
=item Switch: B<-yscrollincrement> |
| 119 |
|
| 120 |
Specifies an increment for vertical scrolling, in any of the usual forms |
| 121 |
permitted for screen distances. If the value of this option is greater |
| 122 |
than zero, the vertical view in the window will be constrained so that |
| 123 |
the canvas y coordinate at the top edge of the window is always an even |
| 124 |
multiple of B<yScrollIncrement>; furthermore, the units for scrolling |
| 125 |
(e.g., the change in view when the top and bottom arrows of a scrollbar |
| 126 |
are selected) will also be B<yScrollIncrement>. If the value of |
| 127 |
this option is less than or equal to zero, then vertical scrolling |
| 128 |
is unconstrained. |
| 129 |
|
| 130 |
=back |
| 131 |
|
| 132 |
=head1 DESCRIPTION |
| 133 |
|
| 134 |
The B<Canvas> method creates a new window (given |
| 135 |
by the $canvas argument) and makes it into a canvas widget. |
| 136 |
Additional options, described above, may be specified on the |
| 137 |
command line or in the option database |
| 138 |
to configure aspects of the canvas such as its colors and 3-D relief. |
| 139 |
The B<canvas> command returns its |
| 140 |
$canvas argument. At the time this command is invoked, |
| 141 |
there must not exist a window named $canvas, but |
| 142 |
$canvas's parent must exist. |
| 143 |
|
| 144 |
Canvas widgets implement structured graphics. |
| 145 |
A canvas displays any number of I<items>, which may be things like |
| 146 |
rectangles, circles, lines, and text. |
| 147 |
Items may be manipulated (e.g. moved or re-colored) and |
| 148 |
L<callbacks|Tk::callbacks> may |
| 149 |
be associated with items in much the same way that the L<bind|Tk::bind> |
| 150 |
method allows callbacks to be bound to widgets. For example, |
| 151 |
a particular callback may be associated with the B<E<lt>Button-1E<gt>> event |
| 152 |
so that the callback is invoked whenever button 1 is pressed with |
| 153 |
the mouse cursor over an item. |
| 154 |
This means that items in a canvas can have behaviors defined by |
| 155 |
the Callbacks bound to them. |
| 156 |
|
| 157 |
=head1 DISPLAY LIST |
| 158 |
|
| 159 |
The items in a canvas are ordered for purposes of display, |
| 160 |
with the first item in the display list being displayed |
| 161 |
first, followed by the next item in the list, and so on. |
| 162 |
Items later in the display list obscure those that are |
| 163 |
earlier in the display list and are sometimes referred to |
| 164 |
as being I<``on top''> of earlier items. |
| 165 |
When a new item is created it is placed at the end of the |
| 166 |
display list, on top of everything else. |
| 167 |
Widget methods may be used to re-arrange the order of the |
| 168 |
display list. |
| 169 |
|
| 170 |
Window items are an exception to the above rules. The underlying |
| 171 |
window systems require them always to be drawn on top of other items. |
| 172 |
In addition, the stacking order of window items |
| 173 |
is not affected by any of the canvas methods; you must use |
| 174 |
the L<raise|Tk::Widget> and L<lower|Tk::Widget> Tk widget methods instead. |
| 175 |
|
| 176 |
=head1 ITEM IDS AND TAGS |
| 177 |
|
| 178 |
Items in a canvas widget may be named in either of two ways: |
| 179 |
by id or by tag. |
| 180 |
Each item has a unique identifying number which is assigned to |
| 181 |
that item when it is created. The id of an item never changes |
| 182 |
and id numbers are never re-used within the lifetime of a |
| 183 |
canvas widget. |
| 184 |
|
| 185 |
Each item may also have any number of I<tags> associated |
| 186 |
with it. A tag is just a string of characters, and it may |
| 187 |
take any form except that of an integer. |
| 188 |
For example, ``x123'' is OK but ``123'' isn't. |
| 189 |
The same tag may be associated with many different items. |
| 190 |
This is commonly done to group items in various interesting |
| 191 |
ways; for example, all selected items might be given the |
| 192 |
tag ``selected''. |
| 193 |
|
| 194 |
The tag B<all> is implicitly associated with every item |
| 195 |
in the canvas; it may be used to invoke operations on |
| 196 |
all the items in the canvas. |
| 197 |
|
| 198 |
The tag B<current> is managed automatically by Tk; |
| 199 |
it applies to the I<current item>, which is the |
| 200 |
topmost item whose drawn area covers the position of |
| 201 |
the mouse cursor. |
| 202 |
If the mouse is not in the canvas widget or is not over |
| 203 |
an item, then no item has the B<current> tag. |
| 204 |
|
| 205 |
When specifying items in canvas methods, if the |
| 206 |
specifier is an integer then it is assumed to refer to |
| 207 |
the single item with that id. |
| 208 |
If the specifier is not an integer, then it is assumed to |
| 209 |
refer to all of the items in the canvas that have a tag |
| 210 |
matching the specifier. |
| 211 |
The symbol I<tagOrId> is used below to indicate that |
| 212 |
an argument specifies either an id that selects a single |
| 213 |
item or a tag that selects zero or more items. |
| 214 |
|
| 215 |
I<tagOrId> may contain a logical expressions of |
| 216 |
tags by using operators: 'E<amp>E<amp>', '||', '^' '!', and parenthezised |
| 217 |
subexpressions. For example: |
| 218 |
|
| 219 |
$c-E<gt>find('withtag', '(aE<amp>E<amp>!b)|(!aE<amp>E<amp>b)'); |
| 220 |
|
| 221 |
or equivalently: |
| 222 |
|
| 223 |
$c-E<gt>find('withtag', 'a^b'); |
| 224 |
|
| 225 |
will find only those items with either "a" or "b" tags, but not both. |
| 226 |
|
| 227 |
Some methods only operate on a single item at a |
| 228 |
time; if I<tagOrId> is specified in a way that |
| 229 |
names multiple items, then the normal behavior is for |
| 230 |
the methods is to use the first (lowest) of these items in |
| 231 |
the display list that is suitable for the method. |
| 232 |
Exceptions are noted in the method descriptions |
| 233 |
below. |
| 234 |
|
| 235 |
=head1 COORDINATES |
| 236 |
|
| 237 |
All coordinates related to canvases are stored as floating-point |
| 238 |
numbers. |
| 239 |
Coordinates and distances are specified in screen units, |
| 240 |
which are floating-point numbers optionally followed |
| 241 |
by one of several letters. |
| 242 |
If no letter is supplied then the distance is in pixels. |
| 243 |
If the letter is B<m> then the distance is in millimeters on |
| 244 |
the screen; if it is B<c> then the distance is in centimeters; |
| 245 |
B<i> means inches, and B<p> means printers points (1/72 inch). |
| 246 |
Larger y-coordinates refer to points lower on the screen; larger |
| 247 |
x-coordinates refer to points farther to the right. |
| 248 |
|
| 249 |
=head1 TRANSFORMATIONS |
| 250 |
|
| 251 |
Normally the origin of the canvas coordinate system is at the |
| 252 |
upper-left corner of the window containing the canvas. |
| 253 |
It is possible to adjust the origin of the canvas |
| 254 |
coordinate system relative to the origin of the window using the |
| 255 |
B<xview> and B<yview> methods; this is typically used |
| 256 |
for scrolling. |
| 257 |
Canvases do not support scaling or rotation of the canvas coordinate |
| 258 |
system relative to the window coordinate system. |
| 259 |
|
| 260 |
Individual items may be moved or scaled using methods |
| 261 |
described below, but they may not be rotated. |
| 262 |
|
| 263 |
=head1 INDICES |
| 264 |
|
| 265 |
Text items support the notion of an I<index> for identifying |
| 266 |
particular positions within the item. |
| 267 |
|
| 268 |
Indices are used for methods such as inserting text, deleting |
| 269 |
a range of characters, and setting the insertion cursor position. |
| 270 |
An index may be specified in any of a number of ways, and |
| 271 |
different types of items may support different forms for |
| 272 |
specifying indices. |
| 273 |
|
| 274 |
In a similar fashion, line and polygon items support I<index> for |
| 275 |
identifying, inserting and deleting subsets of their coordinates. |
| 276 |
Indices are used for commands such as inserting or deleting |
| 277 |
a range of characters or coordinates, and setting the insertion |
| 278 |
cursor position. An index may be specified in any of a number |
| 279 |
of ways, and different types of items may support different forms |
| 280 |
for specifying indices. |
| 281 |
|
| 282 |
Text items support the following forms for an index; if you |
| 283 |
define new types of text-like items, it would be advisable to |
| 284 |
support as many of these forms as practical. |
| 285 |
Note that it is possible to refer to the character just after |
| 286 |
the last one in the text item; this is necessary for such |
| 287 |
tasks as inserting new text at the end of the item. |
| 288 |
Lines and Polygons don't support the insertion cursor |
| 289 |
and the selection. Their indices are supposed to be even |
| 290 |
always, because coordinates always appear in pairs. |
| 291 |
|
| 292 |
=over 4 |
| 293 |
|
| 294 |
=item I<number> |
| 295 |
|
| 296 |
A decimal number giving the position of the desired character |
| 297 |
within the text item. |
| 298 |
0 refers to the first character, 1 to the next character, and |
| 299 |
so on. If indexes are odd for lines and polygons, they will be |
| 300 |
automatically decremented by one. |
| 301 |
A number less than 0 is treated as if it were zero, and a |
| 302 |
number greater than the length of the text item is treated |
| 303 |
as if it were equal to the length of the text item. For |
| 304 |
polygons, numbers less than 0 or greater then the length |
| 305 |
of the coordinate list will be adjusted by adding or substracting |
| 306 |
the length until the result is between zero and the length, |
| 307 |
inclusive. |
| 308 |
|
| 309 |
=item B<end> |
| 310 |
|
| 311 |
Refers to the character or coordinate just after the last one |
| 312 |
in the item (same as the number of characters or coordinates |
| 313 |
in the item). |
| 314 |
|
| 315 |
=item B<insert> |
| 316 |
|
| 317 |
Refers to the character just before which the insertion cursor |
| 318 |
is drawn in this item. Not valid for lines and polygons. |
| 319 |
|
| 320 |
=item B<sel.first> |
| 321 |
|
| 322 |
Refers to the first selected character in the item. |
| 323 |
If the selection isn't in this item then this form is illegal. |
| 324 |
|
| 325 |
=item B<sel.last> |
| 326 |
|
| 327 |
Refers to the last selected character in the item. |
| 328 |
If the selection isn't in this item then this form is illegal. |
| 329 |
|
| 330 |
=item B<[>I<x,y>B<]> |
| 331 |
|
| 332 |
Refers to the character or coordinate at the point given by I<x> and |
| 333 |
I<y>, where I<x> and I<y> are specified in the coordinate |
| 334 |
system of the canvas. |
| 335 |
If I<x> and I<y> lie outside the coordinates covered by the |
| 336 |
text item, then they refer to the first or last character in the |
| 337 |
line that is closest to the given point. |
| 338 |
The Tcl string form "@x,y" is also allowed. |
| 339 |
|
| 340 |
=back |
| 341 |
|
| 342 |
=head1 DASH PATTERNS |
| 343 |
|
| 344 |
Many items support the notion of an dash pattern for outlines. |
| 345 |
|
| 346 |
The first possible syntax is a list of integers. Each element |
| 347 |
represents the number of pixels of a line segment. Only the odd |
| 348 |
segments are drawn using the "outline" color. The other segments |
| 349 |
are drawn transparent. |
| 350 |
|
| 351 |
The second possible syntax is a character list containing only |
| 352 |
5 possible characters B<[.,-_ ]>, with the first 4 characters |
| 353 |
producing a segment of length 1 to 4, respectively, followed |
| 354 |
by a transparent segment of length 2. The space can be used |
| 355 |
repeatedly to enlarge the space between other line elements |
| 356 |
by 1, and can not occur as the first position in the string. |
| 357 |
The main difference of this syntax with the previous one is |
| 358 |
that it it shape-conserving. This means that all values in the dash |
| 359 |
list will be multiplied by the line width before display. This |
| 360 |
assures that "." will always be displayed as a dot and "-" |
| 361 |
always as a dash regardless of the line width. |
| 362 |
|
| 363 |
Some examples, for a line width of 2: |
| 364 |
|
| 365 |
-dash . = -dash [2,4] |
| 366 |
-dash - = -dash [6,4] |
| 367 |
-dash -. = -dash [6,4,2,4] |
| 368 |
-dash -.. = -dash [6,4,2,4,2,4] |
| 369 |
-dash '. ' = -dash [2,8] |
| 370 |
-dash ',' = -dash [4,4] |
| 371 |
|
| 372 |
On systems where only a limited set of dash patterns is available, |
| 373 |
the dash pattern will be displayed as the closest available dash |
| 374 |
pattern. For example, on Windows only the first 4 of the |
| 375 |
above examples are available. The last 2 examples will be |
| 376 |
displayed identically as the first one. |
| 377 |
|
| 378 |
=head1 WIDGET METHODS |
| 379 |
|
| 380 |
The B<Canvas> method creates a widget object. |
| 381 |
This object supports the B<configure> and B<cget> methods |
| 382 |
described in L<Tk::options> which can be used to enquire and |
| 383 |
modify the options described above. |
| 384 |
The widget also inherits all the methods provided by the generic |
| 385 |
L<Tk::Widget|Tk::Widget> class. |
| 386 |
|
| 387 |
The following additional methods are available for canvas widgets: |
| 388 |
|
| 389 |
=over 4 |
| 390 |
|
| 391 |
=item I<$canvas>-E<gt>B<addtag>(I<tag, searchSpec, >?I<arg, arg, ...>?) |
| 392 |
|
| 393 |
For each item that meets the constraints specified by |
| 394 |
I<searchSpec> and the I<arg>s, add |
| 395 |
I<tag> to the list of tags associated with the item if it |
| 396 |
isn't already present on that list. |
| 397 |
It is possible that no items will satisfy the constraints |
| 398 |
given by I<searchSpec> and I<arg>s, in which case the |
| 399 |
method has no effect. |
| 400 |
This command returns an empty string as result. |
| 401 |
I<SearchSpec> and I<arg>'s may take any of the following |
| 402 |
forms: |
| 403 |
|
| 404 |
=over 8 |
| 405 |
|
| 406 |
=item B<above >I<tagOrId> |
| 407 |
|
| 408 |
Selects the item just after (above) the one given by I<tagOrId> |
| 409 |
in the display list. |
| 410 |
If I<tagOrId> denotes more than one item, then the last (topmost) |
| 411 |
of these items in the display list is used. |
| 412 |
|
| 413 |
=item B<all> |
| 414 |
|
| 415 |
Selects all the items in the canvas. |
| 416 |
|
| 417 |
=item B<below >I<tagOrId> |
| 418 |
|
| 419 |
Selects the item just before (below) the one given by I<tagOrId> |
| 420 |
in the display list. |
| 421 |
If I<tagOrId> denotes more than one item, then the first (lowest) |
| 422 |
of these items in the display list is used. |
| 423 |
|
| 424 |
=item B<closest >I<x y >?I<halo>? ?I<start>? |
| 425 |
|
| 426 |
Selects the item closest to the point given by I<x> and I<y>. |
| 427 |
If more than one item is at the same closest distance (e.g. two |
| 428 |
items overlap the point), then the top-most of these items (the |
| 429 |
last one in the display list) is used. |
| 430 |
If I<halo> is specified, then it must be a non-negative |
| 431 |
value. |
| 432 |
Any item closer than I<halo> to the point is considered to |
| 433 |
overlap it. |
| 434 |
The I<start> argument may be used to step circularly through |
| 435 |
all the closest items. |
| 436 |
If I<start> is specified, it names an item using a tag or id |
| 437 |
(if by tag, it selects the first item in the display list with |
| 438 |
the given tag). |
| 439 |
Instead of selecting the topmost closest item, this form will |
| 440 |
select the topmost closest item that is below I<start> in |
| 441 |
the display list; if no such item exists, then the selection |
| 442 |
behaves as if the I<start> argument had not been specified. |
| 443 |
|
| 444 |
=item B<enclosed> I<x1> I<y1> I<x2> I<y2> |
| 445 |
|
| 446 |
Selects all the items completely enclosed within the rectangular |
| 447 |
region given by I<x1>, I<y1>, I<x2>, and I<y2>. |
| 448 |
I<X1> must be no greater then I<x2> and I<y1> must be |
| 449 |
no greater than I<y2>. |
| 450 |
|
| 451 |
=item B<overlapping> I<x1> I<y1> I<x2> I<y2> |
| 452 |
|
| 453 |
Selects all the items that overlap or are enclosed within the |
| 454 |
rectangular region given by I<x1>, I<y1>, I<x2>, |
| 455 |
and I<y2>. |
| 456 |
I<X1> must be no greater then I<x2> and I<y1> must be |
| 457 |
no greater than I<y2>. |
| 458 |
|
| 459 |
=item B<withtag >I<tagOrId> |
| 460 |
|
| 461 |
Selects all the items given by I<tagOrId>. |
| 462 |
|
| 463 |
=back |
| 464 |
|
| 465 |
=item I<$canvas>-E<gt>B<bbox>(I<tagOrId, >?I<tagOrId, tagOrId, ...>?) |
| 466 |
|
| 467 |
Returns a list with four elements giving an approximate bounding box |
| 468 |
for all the items named by the I<tagOrId> arguments. |
| 469 |
The list has the form ``I<x1 y1 x2 y2>'' such that the drawn |
| 470 |
areas of all the named elements are within the region bounded by |
| 471 |
I<x1> on the left, I<x2> on the right, I<y1> on the top, |
| 472 |
and I<y2> on the bottom. |
| 473 |
The return value may overestimate the actual bounding box by |
| 474 |
a few pixels. |
| 475 |
If no items match any of the I<tagOrId> arguments or if the |
| 476 |
matching items have empty bounding boxes (i.e. they have nothing |
| 477 |
to display) |
| 478 |
then an empty string is returned. |
| 479 |
|
| 480 |
=item I<$canvas>-E<gt>B<bind>(I<tagOrId>?, I<sequence>? ?,I<callback>?) |
| 481 |
|
| 482 |
This method associates I<callback> with all the items given by |
| 483 |
I<tagOrId> such that whenever the event sequence given by |
| 484 |
I<sequence> occurs for one of the items the callback will |
| 485 |
be invoked. |
| 486 |
This method is similar to the B<bind> method except that |
| 487 |
it operates on items in a canvas rather than entire widgets. |
| 488 |
See L<Tk::bind> for complete details |
| 489 |
on the syntax of I<sequence> and the substitutions performed |
| 490 |
on I<callback> before invoking it. |
| 491 |
If all arguments are specified then a new binding is created, replacing |
| 492 |
any existing binding for the same I<sequence> and I<tagOrId> |
| 493 |
(if the first character of I<command> is ``+'' then I<command> |
| 494 |
augments an existing binding rather than replacing it). |
| 495 |
In this case the return value is an empty string. |
| 496 |
If I<callback> is omitted then the method returns the I<callback> |
| 497 |
associated with I<tagOrId> and I<sequence> (an error occurs |
| 498 |
if there is no such binding). |
| 499 |
If both I<callback> and I<sequence> are omitted then the method |
| 500 |
returns a list of all the sequences for which bindings have been |
| 501 |
defined for I<tagOrId>. |
| 502 |
|
| 503 |
=over 8 |
| 504 |
|
| 505 |
The only events for which bindings may be specified are those related to |
| 506 |
the mouse and keyboard (such as B<Enter>, B<Leave>, |
| 507 |
B<ButtonPress>, B<Motion>, and B<KeyPress>) or virtual events. |
| 508 |
The handling of events in canvases uses the current item defined |
| 509 |
in L<"ITEM IDS AND TAGS"> above. B<Enter> and B<Leave> events trigger for an |
| 510 |
item when it becomes the current item or ceases to be the current item; |
| 511 |
note that these events are different than B<Enter> and B<Leave> |
| 512 |
events for windows. Mouse-related events are directed to the current |
| 513 |
item, if any. Keyboard-related events are directed to the focus item, if |
| 514 |
any (see the L<focus|/focus> method below for more on this). If a |
| 515 |
virtual event is used in a binding, that binding can trigger only if the |
| 516 |
virtual event is defined by an underlying mouse-related or |
| 517 |
keyboard-related event. |
| 518 |
|
| 519 |
It is possible for multiple bindings to match a particular event. |
| 520 |
This could occur, for example, if one binding is associated with the |
| 521 |
item's id and another is associated with one of the item's tags. |
| 522 |
When this occurs, all of the matching bindings are invoked. |
| 523 |
A binding associated with the B<all> tag is invoked first, |
| 524 |
followed by one binding for each of the item's tags (in order), |
| 525 |
followed by a binding associated with the item's id. |
| 526 |
If there are multiple matching bindings for a single tag, |
| 527 |
then only the most specific binding is invoked. |
| 528 |
A B<continue> in a callback terminates that |
| 529 |
subroutine, and a B<break> method terminates that subroutine |
| 530 |
and skips any remaining callbacks for the event, just as for the |
| 531 |
B<bind> method. |
| 532 |
|
| 533 |
If bindings have been created for a canvas window using the B<CanvasBind> |
| 534 |
method, then they are invoked in addition to bindings created for |
| 535 |
the canvas's items using the B<bind> method. |
| 536 |
The bindings for items will be invoked before any of the bindings |
| 537 |
for the window as a whole. |
| 538 |
|
| 539 |
=back |
| 540 |
|
| 541 |
=item I<$canvas>-E<gt>B<canvasx>(I<screenx>?, I<gridspacing>?) |
| 542 |
|
| 543 |
Given a window x-coordinate in the canvas I<screenx>, this method returns |
| 544 |
the canvas x-coordinate that is displayed at that location. |
| 545 |
If I<gridspacing> is specified, then the canvas coordinate is |
| 546 |
rounded to the nearest multiple of I<gridspacing> units. |
| 547 |
|
| 548 |
=item I<$canvas>-E<gt>B<canvasy>(I<screeny, >?I<gridspacing>?) |
| 549 |
|
| 550 |
Given a window y-coordinate in the canvas I<screeny> this method returns |
| 551 |
the canvas y-coordinate that is displayed at that location. |
| 552 |
If I<gridspacing> is specified, then the canvas coordinate is |
| 553 |
rounded to the nearest multiple of I<gridspacing> units. |
| 554 |
|
| 555 |
=item I<$canvas>-E<gt>B<coords>(I<tagOrId >?I<x0,y0 ...>?) |
| 556 |
|
| 557 |
Query or modify the coordinates that define an item. |
| 558 |
If no coordinates are specified, this method returns a list |
| 559 |
whose elements are the coordinates of the item named by |
| 560 |
I<tagOrId>. |
| 561 |
If coordinates are specified, then they replace the current |
| 562 |
coordinates for the named item. |
| 563 |
If I<tagOrId> refers to multiple items, then |
| 564 |
the first one in the display list is used. |
| 565 |
|
| 566 |
=item I<$canvas>-E<gt>B<create>(I<type, x, y, >?I<x, y, ...>?, ?I<option, value, ...>?) |
| 567 |
|
| 568 |
Create a new item in I<$canvas> of type I<type>. |
| 569 |
The exact format of the arguments after B<type> depends |
| 570 |
on B<type>, but usually they consist of the coordinates for |
| 571 |
one or more points, followed by specifications for zero or |
| 572 |
more item options. |
| 573 |
See the subsections on individual item types below for more |
| 574 |
on the syntax of this method. |
| 575 |
This method returns the id for the new item. |
| 576 |
|
| 577 |
=item I<$canvas>-E<gt>B<dchars>(I<tagOrId, first, >?I<last>?) |
| 578 |
|
| 579 |
For each item given by I<tagOrId>, delete the characters, or coordinates, |
| 580 |
in the range given by I<first> and I<last>, inclusive. |
| 581 |
If some of the items given by I<tagOrId> don't support |
| 582 |
Text items interpret I<first> and I<last> as indices to a character, |
| 583 |
line and polygon items interpret them indices to a coordinate (an x,y pair). |
| 584 |
within the item(s) as described in L<"INDICES"> above. |
| 585 |
If I<last> is omitted, it defaults to I<first>. |
| 586 |
This method returns an empty string. |
| 587 |
|
| 588 |
=item I<$canvas>-E<gt>B<delete>(?I<tagOrId, tagOrId, ...>?) |
| 589 |
|
| 590 |
Delete each of the items given by each I<tagOrId>, and return |
| 591 |
an empty string. |
| 592 |
|
| 593 |
=item I<$canvas>-E<gt>B<dtag>(I<tagOrId, >?I<tagToDelete>?) |
| 594 |
|
| 595 |
For each of the items given by I<tagOrId>, delete the |
| 596 |
tag given by I<tagToDelete> from the list of those |
| 597 |
associated with the item. |
| 598 |
If an item doesn't have the tag I<tagToDelete> then |
| 599 |
the item is unaffected by the method. |
| 600 |
If I<tagToDelete> is omitted then it defaults to I<tagOrId>. |
| 601 |
This method returns an empty string. |
| 602 |
|
| 603 |
=item I<$canvas>-E<gt>B<find>(I<searchCommand, >?I<arg, arg, ...>?) |
| 604 |
|
| 605 |
This method returns a list consisting of all the items that |
| 606 |
meet the constraints specified by I<searchCommand> and |
| 607 |
I<arg>'s. |
| 608 |
I<SearchCommand> and I<args> have any of the forms |
| 609 |
accepted by the B<addtag> method. |
| 610 |
The items are returned in stacking order, with the lowest item first. |
| 611 |
|
| 612 |
=item focus |
| 613 |
|
| 614 |
=item I<$canvas>-E<gt>B<focus>(?I<tagOrId>?) |
| 615 |
|
| 616 |
Set the keyboard focus for the canvas widget to the item given by |
| 617 |
I<tagOrId>. |
| 618 |
If I<tagOrId> refers to several items, then the focus is set |
| 619 |
to the first such item in the display list that supports the |
| 620 |
insertion cursor. |
| 621 |
If I<tagOrId> doesn't refer to any items, or if none of them |
| 622 |
support the insertion cursor, then the focus isn't changed. |
| 623 |
If I<tagOrId> is an empty |
| 624 |
string, then the focus item is reset so that no item has the focus. |
| 625 |
If I<tagOrId> is not specified then the method returns the |
| 626 |
id for the item that currently has the focus, or an empty string |
| 627 |
if no item has the focus. |
| 628 |
|
| 629 |
=over 8 |
| 630 |
|
| 631 |
Once the focus has been set to an item, the item will display |
| 632 |
the insertion cursor and all keyboard events will be directed |
| 633 |
to that item. |
| 634 |
The focus item within a canvas and the focus window on the |
| 635 |
screen (set with the B<focus> method) are totally independent: |
| 636 |
a given item doesn't actually have the input focus unless (a) |
| 637 |
its canvas is the focus window and (b) the item is the focus item |
| 638 |
within the canvas. |
| 639 |
In most cases it is advisable to follow the B<focus> widget |
| 640 |
method with the B<CanvasFocus> method to set the focus window to |
| 641 |
the canvas (if it wasn't there already). |
| 642 |
|
| 643 |
=back |
| 644 |
|
| 645 |
=item I<$canvas>-E<gt>B<gettags>(I<tagOrId>) |
| 646 |
|
| 647 |
Return a list whose elements are the tags associated with the |
| 648 |
item given by I<tagOrId>. |
| 649 |
If I<tagOrId> refers to more than one item, then the tags |
| 650 |
are returned from the first such item in the display list. |
| 651 |
If I<tagOrId> doesn't refer to any items, or if the item |
| 652 |
contains no tags, then an empty string is returned. |
| 653 |
|
| 654 |
=item I<$canvas>-E<gt>B<icursor>(I<tagOrId, index>) |
| 655 |
|
| 656 |
Set the position of the insertion cursor for the item(s) given by I<tagOrId> |
| 657 |
to just before the character whose position is given by I<index>. |
| 658 |
If some or all of the items given by I<tagOrId> don't support |
| 659 |
an insertion cursor then this method has no effect on them. |
| 660 |
See L<"INDICES"> above for a description of the |
| 661 |
legal forms for I<index>. |
| 662 |
Note: the insertion cursor is only displayed in an item if |
| 663 |
that item currently has the keyboard focus (see the widget |
| 664 |
method B<focus>, below), but the cursor position may |
| 665 |
be set even when the item doesn't have the focus. |
| 666 |
This method returns an empty string. |
| 667 |
|
| 668 |
=item I<$canvas>-E<gt>B<index>(I<tagOrId, index>) |
| 669 |
|
| 670 |
This method returns a decimal string giving the numerical index |
| 671 |
within I<tagOrId> corresponding to I<index>. |
| 672 |
I<Index> gives a textual description of the desired position |
| 673 |
as described in L<"INDICES"> above. |
| 674 |
Text items interpret I<index> as an index to a character, |
| 675 |
line and polygon items interpret it as an index to a coordinate (an x,y pair). |
| 676 |
The return value is guaranteed to lie between 0 and the number |
| 677 |
of characters, or coordinates, within the item, inclusive. |
| 678 |
If I<tagOrId> refers to multiple items, then the index |
| 679 |
is processed in the first of these items that supports indexing |
| 680 |
operations (in display list order). |
| 681 |
|
| 682 |
=item I<$canvas>-E<gt>B<insert>(I<tagOrId, beforeThis, string>) |
| 683 |
|
| 684 |
For each of the items given by I<tagOrId>, if the item supports |
| 685 |
text or coordinate, insertion then I<string> is inserted into the item's |
| 686 |
text just before the character, or coordinate, whose index is I<beforeThis>. |
| 687 |
Text items interpret I<beforethis> as an index to a character, |
| 688 |
line and polygon items interpret it as an index to a coordinate (an x,y pair). |
| 689 |
For lines and polygons the I<string> must be a valid coordinate |
| 690 |
sequence. |
| 691 |
See L<"INDICES"> above for information about the forms allowed |
| 692 |
for I<beforeThis>. |
| 693 |
This method returns an empty string. |
| 694 |
|
| 695 |
=item I<$canvas>-E<gt>B<itemcget>(I<tagOrId, >I<option>) |
| 696 |
|
| 697 |
Returns the current value of the configuration option for the |
| 698 |
item given by I<tagOrId> whose name is I<option>. |
| 699 |
This method is similar to the L<cget|Tk::option> method except that |
| 700 |
it applies to a particular item rather than the widget as a whole. |
| 701 |
I<Option> may have any of the values accepted by the B<create> |
| 702 |
method when the item was created. |
| 703 |
If I<tagOrId> is a tag that refers to more than one item, |
| 704 |
the first (lowest) such item is used. |
| 705 |
|
| 706 |
=item I<$canvas>-E<gt>B<itemconfigure>(I<tagOrId, >?I<option>?, ?I<value>?, ?I<option, value, ...>?) |
| 707 |
|
| 708 |
This method is similar to the L<configure|Tk::option> method except |
| 709 |
that it modifies item-specific options for the items given by |
| 710 |
I<tagOrId> instead of modifying options for the overall |
| 711 |
canvas widget. |
| 712 |
If no I<option> is specified, returns a list describing all of |
| 713 |
the available options for the first item given by I<tagOrId> |
| 714 |
(see L<Tk::options> for |
| 715 |
information on the format of this list). If I<option> is specified |
| 716 |
with no I<value>, then the method returns a list describing the |
| 717 |
one named option (this list will be identical to the corresponding |
| 718 |
sublist of the value returned if no I<option> is specified). If |
| 719 |
one or more I<option-value> pairs are specified, then the method |
| 720 |
modifies the given widget option(s) to have the given value(s) in |
| 721 |
each of the items given by I<tagOrId>; in |
| 722 |
this case the method returns an empty string. |
| 723 |
The I<option>s and I<value>s are the same as those permissible |
| 724 |
in the B<create> method when the item(s) were created; |
| 725 |
see the sections describing individual item types below for details |
| 726 |
on the legal options. |
| 727 |
|
| 728 |
=item I<$canvas>-E<gt>B<lower>(I<tagOrId, >?I<belowThis>?) |
| 729 |
|
| 730 |
Move all of the items given by I<tagOrId> to a new position |
| 731 |
in the display list just before the item given by I<belowThis>. |
| 732 |
If I<tagOrId> refers to more than one item then all are moved |
| 733 |
but the relative order of the moved items will not be changed. |
| 734 |
I<BelowThis> is a tag or id; if it refers to more than one |
| 735 |
item then the first (lowest) of these items in the display list is used |
| 736 |
as the destination location for the moved items. |
| 737 |
Note: this method has no effect on window items. Window items always |
| 738 |
obscure other item types, and the stacking order of window items is |
| 739 |
determined by the B<raise> and B<lower> methods of the widget, not the |
| 740 |
B<raise> and B<lower> methods for canvases. |
| 741 |
This method returns an empty string. |
| 742 |
|
| 743 |
=item I<$canvas>-E<gt>B<move>(I<tagOrId, xAmount, yAmount>) |
| 744 |
|
| 745 |
Move each of the items given by I<tagOrId> in the canvas coordinate |
| 746 |
space by adding I<xAmount> to the x-coordinate of each point |
| 747 |
associated with the item and I<yAmount> to the y-coordinate of |
| 748 |
each point associated with the item. |
| 749 |
This method returns an empty string. |
| 750 |
|
| 751 |
=item I<$canvas>-E<gt>B<postscript>(?I<option, value, option, value, ...>?) |
| 752 |
|
| 753 |
Generate a Postscript representation for part or all of the canvas. |
| 754 |
If the B<-file> option is specified then the Postscript is written |
| 755 |
to a file and an empty string is returned; otherwise the Postscript |
| 756 |
is returned as the result of the method. |
| 757 |
If the interpreter that owns the canvas is marked as safe, the operation |
| 758 |
will fail because safe interpreters are not allowed to write files. |
| 759 |
If the B<-channel> option is specified, the argument denotes the name |
| 760 |
of a channel already opened for writing. The Postscript is written to |
| 761 |
that channel, and the channel is left open for further writing at the end |
| 762 |
of the operation. |
| 763 |
The Postscript is created in Encapsulated Postscript form using |
| 764 |
version 3.0 of the Document Structuring Conventions. |
| 765 |
Note: by default Postscript is only generated for information that |
| 766 |
appears in the canvas's window on the screen. If the canvas is |
| 767 |
freshly created it may still have its initial size of 1x1 pixel |
| 768 |
so nothing will appear in the Postscript. To get around this problem |
| 769 |
either invoke the B<update> method to wait for the canvas window |
| 770 |
to reach its final size, or else use the B<-width> and B<-height> |
| 771 |
options to specify the area of the canvas to print. |
| 772 |
The I<option>-I<value> argument pairs provide additional |
| 773 |
information to control the generation of Postscript. The following |
| 774 |
options are supported: |
| 775 |
|
| 776 |
=over 8 |
| 777 |
|
| 778 |
=item B<-colormap> =E<gt> I<hashRef> |
| 779 |
|
| 780 |
I<HashRef> must be a reference to a hash variable or an anonymous hash |
| 781 |
that specifies a color mapping to use in the Postscript. |
| 782 |
Each value of the hash must consist of Postscript |
| 783 |
code to set a particular color value (e.g. ``B<1.0 1.0 0.0 setrgbcolor>''). |
| 784 |
When outputting color information in the Postscript, Tk checks |
| 785 |
to see if there is a key in the hash with the same |
| 786 |
name as the color. |
| 787 |
If so, Tk uses the value of the element as the Postscript method |
| 788 |
to set the color. |
| 789 |
If this option hasn't been specified, or if there isn't a key |
| 790 |
in I<hashRef> for a given color, then Tk uses the red, green, |
| 791 |
and blue intensities from the X color. |
| 792 |
|
| 793 |
=item B<-colormode> =E<gt> I<mode> |
| 794 |
|
| 795 |
Specifies how to output color information. I<Mode> must be either |
| 796 |
B<color> (for full color output), B<gray> (convert all colors |
| 797 |
to their gray-scale equivalents) or B<mono> (convert all colors |
| 798 |
to black or white). |
| 799 |
|
| 800 |
=item B<-file> =E<gt> I<fileName> |
| 801 |
|
| 802 |
Specifies the name of the file in which to write the Postscript. |
| 803 |
If this option isn't specified then the Postscript is returned as the |
| 804 |
result of the method instead of being written to a file. |
| 805 |
|
| 806 |
=item B<-fontmap> =E<gt> I<hashRef> |
| 807 |
|
| 808 |
I<HashRef> must be a reference to a hash variable or an anonymous hash |
| 809 |
that specifies a font mapping to use in the Postscript. |
| 810 |
Each value of the hash must consist of an array reference with |
| 811 |
two elements, which are the name and point size of a Postscript font. |
| 812 |
When outputting Postscript commands for a particular font, Tk |
| 813 |
checks to see if I<hashRef> contains a value with the same |
| 814 |
name as the font. |
| 815 |
If there is such an element, then the font information contained in |
| 816 |
that element is used in the Postscript. |
| 817 |
Otherwise Tk attempts to guess what Postscript font to use. |
| 818 |
Tk's guesses generally only work for well-known fonts such as |
| 819 |
Times and Helvetica and Courier, and only if the X font name does not |
| 820 |
omit any dashes up through the point size. |
| 821 |
For example, B<-*-Courier-Bold-R-Normal--*-120-*> will work but |
| 822 |
B<*Courier-Bold-R-Normal*120*> will not; Tk needs the dashes to |
| 823 |
parse the font name). |
| 824 |
|
| 825 |
=item B<-height> =E<gt> I<size> |
| 826 |
|
| 827 |
Specifies the height of the area of the canvas to print. |
| 828 |
Defaults to the height of the canvas window. |
| 829 |
|
| 830 |
=item B<-pageanchor> =E<gt> I<anchor> |
| 831 |
|
| 832 |
Specifies which point of the printed area of the canvas should appear over |
| 833 |
the positioning point on the page (which is given by the B<-pagex> |
| 834 |
and B<-pagey> options). |
| 835 |
For example, B<-pageanchor>=>B<n> means that the top center of the |
| 836 |
area of the canvas being printed (as it appears in the canvas window) |
| 837 |
should be over the positioning point. Defaults to B<center>. |
| 838 |
|
| 839 |
=item B<-pageheight> =E<gt> I<size> |
| 840 |
|
| 841 |
Specifies that the Postscript should be scaled in both x and y so |
| 842 |
that the printed area is I<size> high on the Postscript page. |
| 843 |
I<Size> consists of a floating-point number followed by |
| 844 |
B<c> for centimeters, B<i> for inches, B<m> for millimeters, |
| 845 |
or B<p> or nothing for printer's points (1/72 inch). |
| 846 |
Defaults to the height of the printed area on the screen. |
| 847 |
If both B<-pageheight> and B<-pagewidth> are specified then |
| 848 |
the scale factor from B<-pagewidth> is used (non-uniform scaling |
| 849 |
is not implemented). |
| 850 |
|
| 851 |
=item B<-pagewidth> =E<gt> I<size> |
| 852 |
|
| 853 |
Specifies that the Postscript should be scaled in both x and y so |
| 854 |
that the printed area is I<size> wide on the Postscript page. |
| 855 |
I<Size> has the same form as for B<-pageheight>. |
| 856 |
Defaults to the width of the printed area on the screen. |
| 857 |
If both B<-pageheight> and B<-pagewidth> are specified then |
| 858 |
the scale factor from B<-pagewidth> is used (non-uniform scaling |
| 859 |
is not implemented). |
| 860 |
|
| 861 |
=item B<-pagex> =E<gt> I<position> |
| 862 |
|
| 863 |
I<Position> gives the x-coordinate of the positioning point on |
| 864 |
the Postscript page, using any of the forms allowed for B<-pageheight>. |
| 865 |
Used in conjunction with the B<-pagey> and B<-pageanchor> options |
| 866 |
to determine where the printed area appears on the Postscript page. |
| 867 |
Defaults to the center of the page. |
| 868 |
|
| 869 |
=item B<-pagey> =E<gt> I<position> |
| 870 |
|
| 871 |
I<Position> gives the y-coordinate of the positioning point on |
| 872 |
the Postscript page, using any of the forms allowed for B<-pageheight>. |
| 873 |
Used in conjunction with the B<-pagex> and B<-pageanchor> options |
| 874 |
to determine where the printed area appears on the Postscript page. |
| 875 |
Defaults to the center of the page. |
| 876 |
|
| 877 |
=item B<-rotate> =E<gt> I<boolean> |
| 878 |
|
| 879 |
I<Boolean> specifies whether the printed area is to be rotated 90 |
| 880 |
degrees. |
| 881 |
In non-rotated output the x-axis of the printed area runs along |
| 882 |
the short dimension of the page (``portrait'' orientation); |
| 883 |
in rotated output the x-axis runs along the long dimension of the |
| 884 |
page (``landscape'' orientation). |
| 885 |
Defaults to non-rotated. |
| 886 |
|
| 887 |
=item B<-width> =E<gt> I<size> |
| 888 |
|
| 889 |
Specifies the width of the area of the canvas to print. |
| 890 |
Defaults to the width of the canvas window. |
| 891 |
|
| 892 |
=item B<-x> => I<position> |
| 893 |
|
| 894 |
Specifies the x-coordinate of the left edge of the area of the |
| 895 |
canvas that is to be printed, in canvas coordinates, not window |
| 896 |
coordinates. |
| 897 |
Defaults to the coordinate of the left edge of the window. |
| 898 |
|
| 899 |
=item B<-y> => I<position> |
| 900 |
|
| 901 |
Specifies the y-coordinate of the top edge of the area of the |
| 902 |
canvas that is to be printed, in canvas coordinates, not window |
| 903 |
coordinates. |
| 904 |
Defaults to the coordinate of the top edge of the window. |
| 905 |
|
| 906 |
=back |
| 907 |
|
| 908 |
=item I<$canvas>-E<gt>B<raise>(I<tagOrId, >?I<aboveThis>?) |
| 909 |
|
| 910 |
Move all of the items given by I<tagOrId> to a new position |
| 911 |
in the display list just after the item given by I<aboveThis>. |
| 912 |
If I<tagOrId> refers to more than one item then all are moved |
| 913 |
but the relative order of the moved items will not be changed. |
| 914 |
I<AboveThis> is a tag or id; if it refers to more than one |
| 915 |
item then the last (topmost) of these items in the display list is used |
| 916 |
as the destination location for the moved items. |
| 917 |
Note: this method has no effect on window items. Window items always |
| 918 |
obscure other item types, and the stacking order of window items is |
| 919 |
determined by the B<raise> and B<lower> widget commands, not the |
| 920 |
B<raise> and B<lower> methods for canvases. |
| 921 |
This method returns an empty string. |
| 922 |
|
| 923 |
=item I<$canvas>-E<gt>B<scale>(I<tagOrId, xOrigin, yOrigin, xScale, yScale>) |
| 924 |
|
| 925 |
Rescale all of the items given by I<tagOrId> in canvas coordinate |
| 926 |
space. |
| 927 |
I<XOrigin> and I<yOrigin> identify the origin for the scaling |
| 928 |
operation and I<xScale> and I<yScale> identify the scale |
| 929 |
factors for x- and y-coordinates, respectively (a scale factor of |
| 930 |
1.0 implies no change to that coordinate). |
| 931 |
For each of the points defining each item, the x-coordinate is |
| 932 |
adjusted to change the distance from I<xOrigin> by a factor |
| 933 |
of I<xScale>. |
| 934 |
Similarly, each y-coordinate is adjusted to change the distance |
| 935 |
from I<yOrigin> by a factor of I<yScale>. |
| 936 |
This method returns an empty string. |
| 937 |
|
| 938 |
=item I<$canvas>-E<gt>B<scan>(I<option, args>) |
| 939 |
|
| 940 |
This method is used to implement scanning on canvases. It has |
| 941 |
two forms, depending on I<option>: |
| 942 |
|
| 943 |
=over 8 |
| 944 |
|
| 945 |
=item I<$canvas>-E<gt>B<scanMark>(I<x, y>) |
| 946 |
|
| 947 |
Records I<x> and I<y> and the canvas's current view; used |
| 948 |
in conjunction with later B<scanDragto> method. |
| 949 |
Typically this method is associated with a mouse button press in |
| 950 |
the widget and I<x> and I<y> are the coordinates of the |
| 951 |
mouse. It returns an empty string. |
| 952 |
|
| 953 |
=item I<$canvas>-E<gt>B<scanDragto>(I<x, y, ?gain?>.) |
| 954 |
|
| 955 |
This method computes the difference between its I<x> and I<y> |
| 956 |
arguments (which are typically mouse coordinates) and the I<x> and |
| 957 |
I<y> arguments to the last B<scanMark> method for the widget. |
| 958 |
It then adjusts the view by 10 times the |
| 959 |
difference in coordinates. This method is typically associated |
| 960 |
It then adjusts the view by I<gain> times the |
| 961 |
difference in coordinates, where I<gain> defaults to 10. |
| 962 |
This command is typically associated |
| 963 |
with mouse motion events in the widget, to produce the effect of |
| 964 |
dragging the canvas at high speed through its window. The return |
| 965 |
value is an empty string. |
| 966 |
|
| 967 |
=back |
| 968 |
|
| 969 |
=item I<$canvas>-E<gt>B<select>(I<option, >?I<tagOrId, arg>?) |
| 970 |
|
| 971 |
Manipulates the selection in one of several ways, depending on |
| 972 |
I<option>. |
| 973 |
The method may take any of the forms described below. |
| 974 |
In all of the descriptions below, I<tagOrId> must refer to |
| 975 |
an item that supports indexing and selection; if it refers to |
| 976 |
multiple items then the first of |
| 977 |
these that supports indexing and the selection is used. |
| 978 |
I<Index> gives a textual description of a position |
| 979 |
within I<tagOrId>, as described in L<"INDICES"> above. |
| 980 |
|
| 981 |
=over 8 |
| 982 |
|
| 983 |
=item I<$canvas>-E<gt>B<selectAdjust>(I<tagOrId, index>) |
| 984 |
|
| 985 |
Locate the end of the selection in I<tagOrId> nearest |
| 986 |
to the character given by I<index>, and adjust that |
| 987 |
end of the selection to be at I<index> (i.e. including |
| 988 |
but not going beyond I<index>). |
| 989 |
The other end of the selection is made the anchor point |
| 990 |
for future B<selectTo> method calls. |
| 991 |
If the selection isn't currently in I<tagOrId> then |
| 992 |
this method behaves the same as the B<selectTo> widget |
| 993 |
method. |
| 994 |
Returns an empty string. |
| 995 |
|
| 996 |
=item I<$canvas>-E<gt>B<selectClear> |
| 997 |
|
| 998 |
Clear the selection if it is in this widget. |
| 999 |
If the selection isn't in this widget then the method |
| 1000 |
has no effect. |
| 1001 |
Returns an empty string. |
| 1002 |
|
| 1003 |
=item I<$canvas>-E<gt>B<selectFrom>(I<tagOrId, index>) |
| 1004 |
|
| 1005 |
Set the selection anchor point for the widget to be just |
| 1006 |
before the character |
| 1007 |
given by I<index> in the item given by I<tagOrId>. |
| 1008 |
This method doesn't change the selection; it just sets |
| 1009 |
the fixed end of the selection for future B<selectTo> |
| 1010 |
method calls. |
| 1011 |
Returns an empty string. |
| 1012 |
|
| 1013 |
=item I<$canvas>-E<gt>B<selectItem> |
| 1014 |
|
| 1015 |
Returns the id of the selected item, if the selection is in an |
| 1016 |
item in this canvas. |
| 1017 |
If the selection is not in this canvas then an empty string |
| 1018 |
is returned. |
| 1019 |
|
| 1020 |
=item I<$canvas>-E<gt>B<selectTo>(I<tagOrId, index>) |
| 1021 |
|
| 1022 |
Set the selection to consist of those characters of I<tagOrId> |
| 1023 |
between the selection anchor point and |
| 1024 |
I<index>. |
| 1025 |
The new selection will include the character given by I<index>; |
| 1026 |
it will include the character given by the anchor point only if |
| 1027 |
I<index> is greater than or equal to the anchor point. |
| 1028 |
The anchor point is determined by the most recent B<selectAdjust> |
| 1029 |
or B<selectFrom> method calls for this widget. |
| 1030 |
If the selection anchor point for the widget isn't currently in |
| 1031 |
I<tagOrId>, then it is set to the same character given |
| 1032 |
by I<index>. |
| 1033 |
Returns an empty string. |
| 1034 |
|
| 1035 |
=back |
| 1036 |
|
| 1037 |
=item I<$canvas>-E<gt>B<type>(I<tagOrId>) |
| 1038 |
|
| 1039 |
Returns the type of the item given by I<tagOrId>, such as |
| 1040 |
B<rectangle> or B<text>. |
| 1041 |
If I<tagOrId> refers to more than one item, then the type |
| 1042 |
of the first item in the display list is returned. |
| 1043 |
If I<tagOrId> doesn't refer to any items at all then |
| 1044 |
an empty string is returned. |
| 1045 |
|
| 1046 |
=item I<$canvas>-E<gt>B<xview>(?I<args>?) |
| 1047 |
|
| 1048 |
This method is used to query and change the horizontal position of the |
| 1049 |
information displayed in the canvas's window. |
| 1050 |
It can take any of the following forms: |
| 1051 |
|
| 1052 |
=over 8 |
| 1053 |
|
| 1054 |
=item I<$canvas>-E<gt>B<xview> |
| 1055 |
|
| 1056 |
Returns a list containing two elements. |
| 1057 |
Each element is a real fraction between 0 and 1; together they describe |
| 1058 |
the horizontal span that is visible in the window. |
| 1059 |
For example, if the first element is .2 and the second element is .6, |
| 1060 |
20% of the canvas's area (as defined by the B<-scrollregion> option) |
| 1061 |
is off-screen to the left, the middle 40% is visible |
| 1062 |
in the window, and 40% of the canvas is off-screen to the right. |
| 1063 |
These are the same values passed to scrollbars via the B<-xscrollcommand> |
| 1064 |
option. |
| 1065 |
|
| 1066 |
=item I<$canvas>-E<gt>B<xviewMoveto>(I<fraction>) |
| 1067 |
|
| 1068 |
Adjusts the view in the window so that I<fraction> of the |
| 1069 |
total width of the canvas is off-screen to the left. |
| 1070 |
I<Fraction> must be a fraction between 0 and 1. |
| 1071 |
|
| 1072 |
=item I<$canvas>-E<gt>B<xviewScroll>(I<number, what>) |
| 1073 |
|
| 1074 |
This method shifts the view in the window left or right according to |
| 1075 |
I<number> and I<what>. |
| 1076 |
I<Number> must be an integer. |
| 1077 |
I<What> must be either B<units> or B<pages> or an abbreviation |
| 1078 |
of one of these. |
| 1079 |
If I<what> is B<units>, the view adjusts left or right in units |
| 1080 |
of the B<xScrollIncrement> option, if it is greater than zero, |
| 1081 |
or in units of one-tenth the window's width otherwise. |
| 1082 |
If I<what is >B<pages> then the view |
| 1083 |
adjusts in units of nine-tenths the window's width. |
| 1084 |
If I<number> is negative then information farther to the left |
| 1085 |
becomes visible; if it is positive then information farther to the right |
| 1086 |
becomes visible. |
| 1087 |
|
| 1088 |
=back |
| 1089 |
|
| 1090 |
=item I<$canvas>-E<gt>B<yview>(I<?args>?) |
| 1091 |
|
| 1092 |
This method is used to query and change the vertical position of the |
| 1093 |
information displayed in the canvas's window. |
| 1094 |
It can take any of the following forms: |
| 1095 |
|
| 1096 |
=over 8 |
| 1097 |
|
| 1098 |
=item I<$canvas>-E<gt>B<yview> |
| 1099 |
|
| 1100 |
Returns a list containing two elements. |
| 1101 |
Each element is a real fraction between 0 and 1; together they describe |
| 1102 |
the vertical span that is visible in the window. |
| 1103 |
For example, if the first element is .6 and the second element is 1.0, |
| 1104 |
the lowest 40% of the canvas's area (as defined by the B<-scrollregion> |
| 1105 |
option) is visible in the window. |
| 1106 |
These are the same values passed to scrollbars via the B<-yscrollcommand> |
| 1107 |
option. |
| 1108 |
|
| 1109 |
=item I<$canvas>-E<gt>B<yviewMoveto>(I<fraction>) |
| 1110 |
|
| 1111 |
Adjusts the view in the window so that I<fraction> of the canvas's |
| 1112 |
area is off-screen to the top. |
| 1113 |
I<Fraction> is a fraction between 0 and 1. |
| 1114 |
|
| 1115 |
=item I<$canvas>-E<gt>B<yviewScroll>(I<number, what>) |
| 1116 |
|
| 1117 |
This method adjusts the view in the window up or down according to |
| 1118 |
I<number> and I<what>. |
| 1119 |
I<Number> must be an integer. |
| 1120 |
I<What> must be either B<units> or B<pages>. |
| 1121 |
If I<what> is B<units>, the view adjusts up or down in units |
| 1122 |
of the B<yScrollIncrement> option, if it is greater than zero, |
| 1123 |
or in units of one-tenth the window's height otherwise. |
| 1124 |
If I<what> is B<pages> then |
| 1125 |
the view adjusts in units of nine-tenths the window's height. |
| 1126 |
If I<number> is negative then higher information becomes |
| 1127 |
visible; if it is positive then lower information |
| 1128 |
becomes visible. |
| 1129 |
|
| 1130 |
=back |
| 1131 |
|
| 1132 |
=back |
| 1133 |
|
| 1134 |
=head1 OVERVIEW OF ITEM TYPES |
| 1135 |
|
| 1136 |
The sections below describe the various types of items supported |
| 1137 |
by canvas widgets. Each item type is characterized by two things: |
| 1138 |
first, the form of the B<create> method used to create |
| 1139 |
instances of the type; and second, a set of configuration options |
| 1140 |
for items of that type, which may be used in the |
| 1141 |
B<create> and B<itemconfigure> methods. |
| 1142 |
Most items don't support indexing or selection or the methods |
| 1143 |
related to them, such as B<index> and B<insert>. |
| 1144 |
Where items do support these facilities, it is noted explicitly |
| 1145 |
in the descriptions below. |
| 1146 |
At present, text, line and polygon items provide this support. |
| 1147 |
For lines and polygons the indexing facility is used to manipulate |
| 1148 |
the coordinates of the item. |
| 1149 |
|
| 1150 |
=head1 ARC ITEMS |
| 1151 |
|
| 1152 |
Items of type B<arc> appear on the display as arc-shaped regions. |
| 1153 |
An arc is a section of an oval delimited by two angles (specified |
| 1154 |
by the B<-start> and B<-extent> options) and displayed in |
| 1155 |
one of several ways (specified by the B<-style> option). |
| 1156 |
Arcs are created with methods of the following form: |
| 1157 |
|
| 1158 |
$canvas->createArc(x1, y1, x2, y2, ?option, value, option, value, ...?) |
| 1159 |
|
| 1160 |
The arguments I<x1>, I<y1>, I<x2>, and I<y2> give |
| 1161 |
the coordinates of two diagonally opposite corners of a |
| 1162 |
rectangular region enclosing the oval that defines the arc. |
| 1163 |
After the coordinates there may be any number of I<option>-I<value> |
| 1164 |
pairs, each of which sets one of the configuration options |
| 1165 |
for the item. These same I<option>-I<value> pairs may be |
| 1166 |
used in B<itemconfigure> methods to change the item's |
| 1167 |
configuration. |
| 1168 |
The following options are supported for arcs: |
| 1169 |
|
| 1170 |
=over 4 |
| 1171 |
|
| 1172 |
=item B<-dash> =E<gt> I<pattern> |
| 1173 |
|
| 1174 |
=item B<-activedash> =E<gt> I<pattern> |
| 1175 |
|
| 1176 |
=item B<-disableddash> =E<gt> I<pattern> |
| 1177 |
|
| 1178 |
This option specifies dash patterns for the normal state, the active |
| 1179 |
state, and the disabled state of an arc item. |
| 1180 |
I<pattern> may have any of the forms accepted by B<Tk_GetDash>. |
| 1181 |
If the dash options are omitted then the default is a solid outline. |
| 1182 |
|
| 1183 |
=item B<-dashoffset> =E<gt> I<offset> |
| 1184 |
|
| 1185 |
The starting I<offset> into the pattern provided by the |
| 1186 |
B<-dash> option. |
| 1187 |
B<-dashoffset> is ignored if there is no B<-dash> pattern. |
| 1188 |
|
| 1189 |
=item B<-extent> =E<gt> I<degrees> |
| 1190 |
|
| 1191 |
Specifies the size of the angular range occupied by the arc. |
| 1192 |
The arc's range extends for I<degrees> degrees counter-clockwise |
| 1193 |
from the starting angle given by the B<-start> option. |
| 1194 |
I<Degrees> may be negative. |
| 1195 |
If it is greater than 360 or less than -360, then I<degrees> |
| 1196 |
modulo 360 is used as the extent. |
| 1197 |
|
| 1198 |
=item B<-fill> =E<gt> I<color> |
| 1199 |
|
| 1200 |
=item B<-activefill> =E<gt> I<color> |
| 1201 |
|
| 1202 |
=item B<-disabledfill> =E<gt> I<color> |
| 1203 |
|
| 1204 |
Specifies the color to be used to fill the arc region in its normal, active, and |
| 1205 |
disabled states, |
| 1206 |
I<Color> may have any of the forms accepted by B<Tk_GetColor>. |
| 1207 |
If I<color> is an empty string (the default), then |
| 1208 |
then the arc will not be filled. |
| 1209 |
|
| 1210 |
=item B<-outline> =E<gt> I<color> |
| 1211 |
|
| 1212 |
=item B<-activeoutline> =E<gt> I<color> |
| 1213 |
|
| 1214 |
=item B<-disabledoutline> =E<gt> I<color> |
| 1215 |
|
| 1216 |
This option specifies the color that should be used to draw the |
| 1217 |
outline of the arc in its normal, active and disabled states. |
| 1218 |
I<Color> may have any of the forms accepted by B<Tk_GetColor>. |
| 1219 |
This option defaults to B<black>. If I<color> is specified |
| 1220 |
as undef then no outline is drawn for the arc. |
| 1221 |
|
| 1222 |
=item B<-outlinestipple> =E<gt> I<bitmap> |
| 1223 |
|
| 1224 |
=item B<-activeoutlinestipple> =E<gt> I<bitmap> |
| 1225 |
|
| 1226 |
=item B<-disabledoutlinestipple> =E<gt> I<bitmap> |
| 1227 |
|
| 1228 |
This option specifies stipple patterns that should be used to draw the |
| 1229 |
outline of the arc in its normal, active and disabled states. |
| 1230 |
Indicates that the outline for the arc should be drawn with a stipple pattern; |
| 1231 |
I<bitmap> specifies the stipple pattern to use, in any of the |
| 1232 |
forms accepted by B<Tk_GetBitmap>. |
| 1233 |
If the B<-outline> option hasn't been specified then this option |
| 1234 |
has no effect. |
| 1235 |
If I<bitmap> is an empty string (the default), then the outline is drawn |
| 1236 |
in a solid fashion. |
| 1237 |
|
| 1238 |
=item B<-start> =E<gt> I<degrees> |
| 1239 |
|
| 1240 |
Specifies the beginning of the angular range occupied by the |
| 1241 |
arc. |
| 1242 |
I<Degrees> is given in units of degrees measured counter-clockwise |
| 1243 |
from the 3-o'clock position; it may be either positive or negative. |
| 1244 |
|
| 1245 |
=item B<-state> =E<gt> I<state> |
| 1246 |
|
| 1247 |
Modifies the state of the arc item where I<state> may be set to one of: |
| 1248 |
normal, disabled, hidden or "". If set to empty, the state of the canvas |
| 1249 |
itself is used. An arc item may also be in the "active" |
| 1250 |
state if the mouse is currently over it. Many options can take |
| 1251 |
separate specifications in normal, active and disabled states such that the |
| 1252 |
appearance of the item can be different in each state. |
| 1253 |
|
| 1254 |
=item B<-stipple> =E<gt> I<bitmap> |
| 1255 |
|
| 1256 |
=item B<-activestipple> =E<gt> I<bitmap> |
| 1257 |
|
| 1258 |
=item B<-disabledstipple> =E<gt> I<bitmap> |
| 1259 |
|
| 1260 |
This option specifies stipple patterns that should be used to fill the |
| 1261 |
the arc in its normal, active and disabled states. |
| 1262 |
I<bitmap> specifies the stipple pattern to use, in any of the |
| 1263 |
forms accepted by B<Tk_GetBitmap>. |
| 1264 |
If the B<-fill> option hasn't been specified then this option |
| 1265 |
has no effect. |
| 1266 |
If I<bitmap> is an empty string (the default), then filling is done |
| 1267 |
in a solid fashion. |
| 1268 |
|
| 1269 |
=item B<-style> =E<gt> I<type> |
| 1270 |
|
| 1271 |
Specifies how to draw the arc. If I<type> is B<pieslice> |
| 1272 |
(the default) then the arc's region is defined by a section |
| 1273 |
of the oval's perimeter plus two line segments, one between the center |
| 1274 |
of the oval and each end of the perimeter section. |
| 1275 |
If I<type> is B<chord> then the arc's region is defined |
| 1276 |
by a section of the oval's perimeter plus a single line segment |
| 1277 |
connecting the two end points of the perimeter section. |
| 1278 |
If I<type> is B<arc> then the arc's region consists of |
| 1279 |
a section of the perimeter alone. |
| 1280 |
In this last case the B<-fill> option is ignored. |
| 1281 |
|
| 1282 |
=item B<-tags> =E<gt> I<tagList> |
| 1283 |
|
| 1284 |
Specifies a set of tags to apply to the item. |
| 1285 |
I<TagList> consists of a list of tag names, which replace any |
| 1286 |
existing tags for the item. |
| 1287 |
I<TagList> may be an empty list. |
| 1288 |
|
| 1289 |
=item B<-updatecommand> =E<gt> I<command> |
| 1290 |
|
| 1291 |
Specifies a callback that is to be executed every time |
| 1292 |
the arc item is updated on the screen. |
| 1293 |
|
| 1294 |
=item B<-width> =E<gt> I<outlineWidth> |
| 1295 |
|
| 1296 |
=item B<-activewidth> =E<gt> I<outlineWidth> |
| 1297 |
|
| 1298 |
=item B<-disabledwidth> =E<gt> I<outlineWidth> |
| 1299 |
|
| 1300 |
Specifies the width of the outline to be drawn around |
| 1301 |
the arc's region, in its normal, active and disabled states. |
| 1302 |
I<outlineWidth> may be in any of the forms described in |
| 1303 |
the L<"COORDINATES"> section above. |
| 1304 |
If the B<-outline> option has been specified as undef |
| 1305 |
then this option has no effect. |
| 1306 |
Wide outlines will be drawn centered on the edges of the arc's region. |
| 1307 |
This option defaults to 1.0. |
| 1308 |
|
| 1309 |
=back |
| 1310 |
|
| 1311 |
=head1 BITMAP ITEMS |
| 1312 |
|
| 1313 |
Items of type B<bitmap> appear on the display as images with |
| 1314 |
two colors, foreground and background. |
| 1315 |
Bitmaps are created with methods of the following form: |
| 1316 |
|
| 1317 |
$canvas->createBitmap(x, y, ?option, value, option, value, ...?) |
| 1318 |
|
| 1319 |
The arguments I<x> and I<y> specify the coordinates of a |
| 1320 |
point used to position the bitmap on the display (see the B<-anchor> |
| 1321 |
option below for more information on how bitmaps are displayed). |
| 1322 |
After the coordinates there may be any number of I<option>-I<value> |
| 1323 |
pairs, each of which sets one of the configuration options |
| 1324 |
for the item. These same I<option>-I<value> pairs may be |
| 1325 |
used in B<itemconfigure> methods to change the item's |
| 1326 |
configuration. |
| 1327 |
The following options are supported for bitmaps: |
| 1328 |
|
| 1329 |
=over 4 |
| 1330 |
|
| 1331 |
=item B<-anchor> =E<gt> I<anchorPos> |
| 1332 |
|
| 1333 |
I<AnchorPos> tells how to position the bitmap relative to the |
| 1334 |
positioning point for the item; it may have any of the forms |
| 1335 |
accepted by B<Tk_GetAnchor>. For example, if I<anchorPos> |
| 1336 |
is B<center> then the bitmap is centered on the point; if |
| 1337 |
I<anchorPos> is B<n> then the bitmap will be drawn so that |
| 1338 |
its top center point is at the positioning point. |
| 1339 |
This option defaults to B<center>. |
| 1340 |
|
| 1341 |
=item B<-background> =E<gt> I<color> |
| 1342 |
|
| 1343 |
=item B<-activebackground> =E<gt> I<color> |
| 1344 |
|
| 1345 |
=item B<-disabledbackground> =E<gt> I<color> |
| 1346 |
|
| 1347 |
Specifies the color to use for each of the bitmap's '0' valued pixels |
| 1348 |
in its normal, active and disabled states. |
| 1349 |
I<Color> may have any of the forms accepted by B<Tk_GetColor>. |
| 1350 |
If this option isn't specified, or if it is specified as undef, |
| 1351 |
then nothing is displayed where the bitmap pixels are 0; this |
| 1352 |
produces a transparent effect. |
| 1353 |
|
| 1354 |
=item B<-bitmap> =E<gt> I<bitmap> |
| 1355 |
|
| 1356 |
=item B<-activebitmap> =E<gt> I<bitmap> |
| 1357 |
|
| 1358 |
=item B<-disabledbitmap> =E<gt> I<bitmap> |
| 1359 |
|
| 1360 |
Specifies the bitmaps to display in the item in its normal, active and |
| 1361 |
disabled states. All bitmaps must have the same width and height. |
| 1362 |
I<Bitmap> may have any of the forms accepted by B<Tk_GetBitmap>. |
| 1363 |
|
| 1364 |
=item B<-foreground> =E<gt> I<color> |
| 1365 |
|
| 1366 |
=item B<-activeforeground> =E<gt> I<color> |
| 1367 |
|
| 1368 |
=item B<-disabledforeground> =E<gt> I<color> |
| 1369 |
|
| 1370 |
Specifies the color to use for each of the bitmap's '1' valued pixels |
| 1371 |
in its normal, active and disabled states. |
| 1372 |
I<Color> may have any of the forms accepted by B<Tk_GetColor> and |
| 1373 |
defaults to B<black>. |
| 1374 |
|
| 1375 |
=item B<-state> =E<gt> I<state> |
| 1376 |
|
| 1377 |
Modifies the state of the bitmap item where I<state> may be set to one of: |
| 1378 |
normal, disabled, or hidden. An bitmap item may also be in the "active" |
| 1379 |
state if the mouse is currently over it. Many options can take |
| 1380 |
separate specifications in normal, active and disabled states such that the |
| 1381 |
appearance of the item can be different in each state. |
| 1382 |
|
| 1383 |
=item B<-tags> =E<gt> I<tagList> |
| 1384 |
|
| 1385 |
Specifies a set of tags to apply to the item. |
| 1386 |
I<TagList> consists of a list of tag names, which replace any |
| 1387 |
existing tags for the item. |
| 1388 |
I<TagList> may be an empty list. |
| 1389 |
|
| 1390 |
=item B<-updatecommand> =E<gt> I<command> |
| 1391 |
|
| 1392 |
Specifies a callback that is to be executed every time |
| 1393 |
the bitmap item is updated on the screen. |
| 1394 |
|
| 1395 |
=back |
| 1396 |
|
| 1397 |
=head1 GRID ITEMS |
| 1398 |
|
| 1399 |
Items of type B<grid> are intended for producing a visual reference for |
| 1400 |
interpreting other items. They can be drawn as either lines (with dash |
| 1401 |
style) or as rectangular "dots" at each grid point. |
| 1402 |
|
| 1403 |
Items of type B<grid> are unlike other items they always cover the |
| 1404 |
whole of the canvas, but are never enclosed by nor overlap any area |
| 1405 |
and are not near any point. That is they are intended to be always visible |
| 1406 |
but not "pickable", as such they do support the "active" state. |
| 1407 |
They are like other items in that: multiple |
| 1408 |
grids are permitted, they can be raised and lowered relative to other |
| 1409 |
items, they can be moved and scaled. As yet grids do not appear in |
| 1410 |
PostScript output. |
| 1411 |
|
| 1412 |
Grids have outline like configure options. Grids are created with methods of the |
| 1413 |
following form: |
| 1414 |
|
| 1415 |
$canvas->createGrid(x1, y1, x2, y2, ?option, value, option, value, ...?) |
| 1416 |
|
| 1417 |
The arguments I<x1>, I<y1> give the origin of the grid. I<x2>, and I<y2> give |
| 1418 |
the coordinates of the next grid point in their respective directions. |
| 1419 |
After the coordinates there may be any number of I<option>-I<value> |
| 1420 |
pairs, each of which sets one of the configuration options |
| 1421 |
for the item. These same I<option>-I<value> pairs may be |
| 1422 |
used in B<itemconfigure> methods to change the item's |
| 1423 |
configuration. |
| 1424 |
|
| 1425 |
The following options are supported for grids: |
| 1426 |
|
| 1427 |
=over 4 |
| 1428 |
|
| 1429 |
=item B<-lines> =E<gt> I<boolean> |
| 1430 |
|
| 1431 |
If B<-lines> is set to a true value then lines are drawn for both X and Y |
| 1432 |
grids in the style determined by B<-dash>. Otherwise retangular "dots" |
| 1433 |
are drawn at each grid point. |
| 1434 |
|
| 1435 |
=item B<-dash> =E<gt> I<pattern> |
| 1436 |
|
| 1437 |
=item B<-disableddash> =E<gt> I<pattern> |
| 1438 |
|
| 1439 |
This option specifies dash patterns for the normal state, |
| 1440 |
and the disabled state of a grid item. |
| 1441 |
I<pattern> may have any of the forms accepted by B<Tk_GetDash>. |
| 1442 |
If the dash options are omitted then the default is a solid outline. |
| 1443 |
|
| 1444 |
=item B<-dashoffset> =E<gt> I<offset> |
| 1445 |
|
| 1446 |
The starting I<offset> into the pattern provided by the |
| 1447 |
B<-dash> option. |
| 1448 |
B<-dashoffset> is ignored if there is no B<-dash> pattern. |
| 1449 |
|
| 1450 |
=item B<-color> =E<gt> I<color> |
| 1451 |
|
| 1452 |
=item B<-disabledcolor> =E<gt> I<color> |
| 1453 |
|
| 1454 |
This option specifies the color that should be used to draw the |
| 1455 |
outline of the grid in its normal and disabled states. |
| 1456 |
I<Color> may have any of the forms accepted by B<Tk_GetColor>. |
| 1457 |
This option defaults to B<black>. |
| 1458 |
If I<color> is undef then no grid will be drawn. |
| 1459 |
|
| 1460 |
=item B<-stipple> =E<gt> I<bitmap> |
| 1461 |
|
| 1462 |
=item B<-disabledstipple> =E<gt> I<bitmap> |
| 1463 |
|
| 1464 |
This option specifies stipple patterns that should be used to draw the |
| 1465 |
outline of the rectangle in its normal and disabled states. |
| 1466 |
I<bitmap> specifies the stipple pattern to use, in any of the |
| 1467 |
forms accepted by B<Tk_GetBitmap>. |
| 1468 |
If I<bitmap> is an empty string (the default), then the outline is drawn |
| 1469 |
in a solid fashion. |
| 1470 |
|
| 1471 |
=item B<-state> =E<gt> I<state> |
| 1472 |
|
| 1473 |
Modifies the state of the rectangle item where I<state> may be set to one of: |
| 1474 |
normal, disabled, or hidden. Many options can take |
| 1475 |
separate specifications in normal and disabled states such that the |
| 1476 |
appearance of the item can be different in each state. |
| 1477 |
|
| 1478 |
=item B<-tags> =E<gt> I<tagList> |
| 1479 |
|
| 1480 |
Specifies a set of tags to apply to the item. |
| 1481 |
I<TagList> consists of a list of tag names, which replace any |
| 1482 |
existing tags for the item. |
| 1483 |
I<TagList> may be an empty list. |
| 1484 |
|
| 1485 |
=item B<-updatecommand> =E<gt> I<command> |
| 1486 |
|
| 1487 |
Specifies a callback that is to be executed every time |
| 1488 |
the grid item is updated on the screen. |
| 1489 |
|
| 1490 |
=item B<-width> =E<gt> I<outlineWidth> |
| 1491 |
|
| 1492 |
=item B<-disabledwidth> =E<gt> I<outlineWidth> |
| 1493 |
|
| 1494 |
Specifies the width of the lines drawn by the grid or the size (in both X and Y) |
| 1495 |
of the dots, in its normal and disabled states. |
| 1496 |
This option defaults to 1.0. |
| 1497 |
|
| 1498 |
=back |
| 1499 |
|
| 1500 |
=head1 IMAGE ITEMS |
| 1501 |
|
| 1502 |
Items of type B<image> are used to display images on a |
| 1503 |
canvas. |
| 1504 |
Images are created with methods of the following form: |
| 1505 |
|
| 1506 |
$canvas->createImage(x, y, ?option, value, option, value, ...?) |
| 1507 |
|
| 1508 |
The arguments I<x> and I<y> specify the coordinates of a |
| 1509 |
point used to position the image on the display (see the B<-anchor> |
| 1510 |
option below for more information). |
| 1511 |
After the coordinates there may be any number of I<option>-I<value> |
| 1512 |
pairs, each of which sets one of the configuration options |
| 1513 |
for the item. These same I<option>-I<value> pairs may be |
| 1514 |
used in B<itemconfigure> methods to change the item's |
| 1515 |
configuration. |
| 1516 |
The following options are supported for images: |
| 1517 |
|
| 1518 |
=over 4 |
| 1519 |
|
| 1520 |
=item B<-anchor> =E<gt> I<anchorPos> |
| 1521 |
|
| 1522 |
I<AnchorPos> tells how to position the image relative to the |
| 1523 |
positioning point for the item; it may have any of the forms |
| 1524 |
accepted by B<Tk_GetAnchor>. For example, if I<anchorPos> |
| 1525 |
is B<center> then the image is centered on the point; if |
| 1526 |
I<anchorPos> is B<n> then the image will be drawn so that |
| 1527 |
its top center point is at the positioning point. |
| 1528 |
This option defaults to B<center>. |
| 1529 |
|
| 1530 |
=item B<-image> =E<gt> I<name> |
| 1531 |
|
| 1532 |
=item B<-activeimage> =E<gt> I<name> |
| 1533 |
|
| 1534 |
=item B<-disabledimage> =E<gt> I<name> |
| 1535 |
|
| 1536 |
Specifies the name of the images to display in the item in is normal, |
| 1537 |
active and disabled states. This image must have been created |
| 1538 |
previously, see L<Tk::Image>. |
| 1539 |
|
| 1540 |
=item B<-state> =E<gt> I<state> |
| 1541 |
|
| 1542 |
Modifies the state of the image item where I<state> may be set to one of: |
| 1543 |
normal, disabled, or hidden. An image item may also be in the "active" |
| 1544 |
state if the mouse is currently over it. Many options can take |
| 1545 |
separate specifications in normal, active and disabled states such that the |
| 1546 |
appearance of the item can be different in each state. |
| 1547 |
|
| 1548 |
=item B<-tags> =E<gt> I<tagList> |
| 1549 |
|
| 1550 |
Specifies a set of tags to apply to the item. |
| 1551 |
I<TagList> consists of a list of tag names, which replace any |
| 1552 |
existing tags for the item; it may be an empty list. |
| 1553 |
|
| 1554 |
=item B<-updatecommand> =E<gt> I<command> |
| 1555 |
|
| 1556 |
Specifies a callback that is to be executed every time |
| 1557 |
the image item is updated on the screen. |
| 1558 |
|
| 1559 |
=back |
| 1560 |
|
| 1561 |
=head1 LINE ITEMS |
| 1562 |
|
| 1563 |
Items of type B<line> appear on the display as one or more connected |
| 1564 |
line segments or curves. |
| 1565 |
Line items support coordinate indexing operations using the canvas |
| 1566 |
methods: B<dchars, index, insert.> |
| 1567 |
Lines are created with methods of the following form: |
| 1568 |
|
| 1569 |
$canvas->createLine(x1, y1..., xn, yn, ?option, value, option, value, ...?) |
| 1570 |
|
| 1571 |
The arguments I<x1> through I<yn> give |
| 1572 |
the coordinates for a series of two or more points that describe |
| 1573 |
a series of connected line segments. |
| 1574 |
After the coordinates there may be any number of I<option>-I<value> |
| 1575 |
pairs, each of which sets one of the configuration options |
| 1576 |
for the item. These same I<option>-I<value> pairs may be |
| 1577 |
used in B<itemconfigure> methods to change the item's |
| 1578 |
configuration. |
| 1579 |
The following options are supported for lines: |
| 1580 |
|
| 1581 |
=over 4 |
| 1582 |
|
| 1583 |
=item B<-arrow> =E<gt> I<where> |
| 1584 |
|
| 1585 |
Indicates whether or not arrowheads are to be drawn at one or both |
| 1586 |
ends of the line. |
| 1587 |
I<Where> must have one of the values B<none> (for no arrowheads), |
| 1588 |
B<first> (for an arrowhead at the first point of the line), |
| 1589 |
B<last> (for an arrowhead at the last point of the line), or |
| 1590 |
B<both> (for arrowheads at both ends). |
| 1591 |
This option defaults to B<none>. |
| 1592 |
|
| 1593 |
=item B<-arrowshape> =E<gt> I<shape> |
| 1594 |
|
| 1595 |
This option indicates how to draw arrowheads. |
| 1596 |
The I<shape> argument must be a list with three elements, each |
| 1597 |
specifying a distance in any of the forms described in |
| 1598 |
the L<"COORDINATES"> section above. |
| 1599 |
The first element of the list gives the distance along the line |
| 1600 |
from the neck of the arrowhead to its tip. |
| 1601 |
The second element gives the distance along the line from the |
| 1602 |
trailing points of the arrowhead to the tip, and the third |
| 1603 |
element gives the distance from the outside edge of the line to the |
| 1604 |
trailing points. |
| 1605 |
If this option isn't specified then Tk picks a ``reasonable'' shape. |
| 1606 |
|
| 1607 |
=item B<-capstyle> =E<gt> I<style> |
| 1608 |
|
| 1609 |
Specifies the ways in which caps are to be drawn at the endpoints |
| 1610 |
of the line. |
| 1611 |
I<Style> may have any of the forms accepted by B<Tk_GetCapStyle> |
| 1612 |
(B<butt>, B<projecting>, or B<round>). |
| 1613 |
If this option isn't specified then it defaults to B<butt>. |
| 1614 |
Where arrowheads are drawn the cap style is ignored. |
| 1615 |
|
| 1616 |
=item B<-dash> =E<gt> I<pattern> |
| 1617 |
|
| 1618 |
=item B<-activedash> =E<gt> I<pattern> |
| 1619 |
|
| 1620 |
=item B<-disableddash> =E<gt> I<pattern> |
| 1621 |
|
| 1622 |
This option specifies dash patterns for the normal state, the active |
| 1623 |
state, and the disabled state of a line item. |
| 1624 |
I<pattern> may have any of the forms accepted by B<Tk_GetDash>. |
| 1625 |
If the dash options are omitted then the default is a solid outline. |
| 1626 |
|
| 1627 |
=item B<-dashoffset> =E<gt> I<offset> |
| 1628 |
|
| 1629 |
The starting I<offset> into the pattern provided by the |
| 1630 |
B<-dash> option. |
| 1631 |
B<-dashoffset> is ignored if there is no B<-dash> pattern. |
| 1632 |
|
| 1633 |
=item B<-fill> =E<gt> I<color> |
| 1634 |
|
| 1635 |
=item B<-activefill> =E<gt> I<color> |
| 1636 |
|
| 1637 |
=item B<-disabledfill> =E<gt> I<color> |
| 1638 |
|
| 1639 |
Specifies the color to be used to fill the line in its normal, active, and |
| 1640 |
disabled states. |
| 1641 |
I<Color> may have |
| 1642 |
any of the forms acceptable to B<Tk_GetColor>. It may also be undef, |
| 1643 |
in which case the line will be transparent. |
| 1644 |
This option defaults to B<black>. |
| 1645 |
|
| 1646 |
=item B<-joinstyle> =E<gt> I<style> |
| 1647 |
|
| 1648 |
Specifies the ways in which joints are to be drawn at the vertices |
| 1649 |
of the line. |
| 1650 |
I<Style> may have any of the forms accepted by B<Tk_GetCapStyle> |
| 1651 |
(B<bevel>, B<miter>, or B<round>). |
| 1652 |
If this option isn't specified then it defaults to B<miter>. |
| 1653 |
If the line only contains two points then this option is |
| 1654 |
irrelevant. |
| 1655 |
|
| 1656 |
=item B<-smooth> =E<gt> I<boolean> |
| 1657 |
|
| 1658 |
I<Boolean> must have one of the forms accepted by B<Tk_GetBoolean>. |
| 1659 |
It indicates whether or not the line should be drawn as a curve. |
| 1660 |
If so, the line is rendered as a set of parabolic splines: one spline |
| 1661 |
is drawn for the first and second line segments, one for the second |
| 1662 |
and third, and so on. Straight-line segments can be generated within |
| 1663 |
a curve by duplicating the end-points of the desired line segment. |
| 1664 |
|
| 1665 |
=item B<-splinesteps> =E<gt> I<number> |
| 1666 |
|
| 1667 |
Specifies the degree of smoothness desired for curves: each spline |
| 1668 |
will be approximated with I<number> line segments. This |
| 1669 |
option is ignored unless the B<-smooth> option is true. |
| 1670 |
|
| 1671 |
=item B<-state> =E<gt> I<state> |
| 1672 |
|
| 1673 |
Modifies the state of the line item where I<state> may be set to one of: |
| 1674 |
normal, disabled, or hidden. A line item may also be in the "active" |
| 1675 |
state if the mouse is currently over it. Many options can take |
| 1676 |
separate specifications in normal, active and disabled states such that the |
| 1677 |
appearance of the item can be different in each state. |
| 1678 |
|
| 1679 |
=item B<-stipple> =E<gt> I<bitmap> |
| 1680 |
|
| 1681 |
=item B<-activestipple> =E<gt> I<bitmap> |
| 1682 |
|
| 1683 |
=item B<-disabledstipple> =E<gt> I<bitmap> |
| 1684 |
|
| 1685 |
This option specifies stipple patterns that should be used to fill the |
| 1686 |
the line in its normal, active and disabled states. |
| 1687 |
I<bitmap> specifies the stipple pattern to use, in any of the |
| 1688 |
forms accepted by B<Tk_GetBitmap>. |
| 1689 |
If I<bitmap> is an empty string (the default), then filling is |
| 1690 |
done in a solid fashion. |
| 1691 |
|
| 1692 |
=item B<-tags> =E<gt> I<tagList> |
| 1693 |
|
| 1694 |
Specifies a set of tags to apply to the item. |
| 1695 |
I<TagList> consists of a list of tag names, which replace any |
| 1696 |
existing tags for the item. |
| 1697 |
I<TagList> may be an empty list. |
| 1698 |
|
| 1699 |
=item B<-updatecommand> =E<gt> I<command> |
| 1700 |
|
| 1701 |
Specifies a callback that is to be executed every time |
| 1702 |
the line item is updated on the screen. |
| 1703 |
|
| 1704 |
=item B<-width> =E<gt> I<lineWidth> |
| 1705 |
|
| 1706 |
=item B<-activewidth> =E<gt> I<lineWidth> |
| 1707 |
|
| 1708 |
=item B<-disabledwidth> =E<gt> I<lineWidth> |
| 1709 |
|
| 1710 |
Specifies the width of the line |
| 1711 |
in its normal, active and disabled states. |
| 1712 |
I<lineWidth> may be in any of the forms |
| 1713 |
described in the L<"COORDINATES"> section above. |
| 1714 |
|
| 1715 |
Wide lines will be drawn centered on the path specified by the |
| 1716 |
points. |
| 1717 |
If this option isn't specified then it defaults to 1.0. |
| 1718 |
|
| 1719 |
=back |
| 1720 |
|
| 1721 |
=head1 OVAL ITEMS |
| 1722 |
|
| 1723 |
Items of type B<oval> appear as circular or oval regions on |
| 1724 |
the display. Each oval may have an outline, a fill, or |
| 1725 |
both. Ovals are created with methods of the |
| 1726 |
following form: |
| 1727 |
|
| 1728 |
$canvas->createOval(x1, y1, x2, y2, ?option, value, option, value, ...?) |
| 1729 |
|
| 1730 |
The arguments I<x1>, I<y1>, I<x2>, and I<y2> give |
| 1731 |
the coordinates of two diagonally opposite corners of a |
| 1732 |
rectangular region enclosing the oval. |
| 1733 |
The oval will include the top and left edges of the rectangle |
| 1734 |
not the lower or right edges. |
| 1735 |
If the region is square then the resulting oval is circular; |
| 1736 |
otherwise it is elongated in shape. |
| 1737 |
After the coordinates there may be any number of I<option>-I<value> |
| 1738 |
pairs, each of which sets one of the configuration options |
| 1739 |
for the item. These same I<option>-I<value> pairs may be |
| 1740 |
used in B<itemconfigure> methods to change the item's |
| 1741 |
configuration. |
| 1742 |
The following options are supported for ovals: |
| 1743 |
|
| 1744 |
=over 4 |
| 1745 |
|
| 1746 |
=item B<-dash> =E<gt> I<pattern> |
| 1747 |
|
| 1748 |
=item B<-activedash> =E<gt> I<pattern> |
| 1749 |
|
| 1750 |
=item B<-disableddash> =E<gt> I<pattern> |
| 1751 |
|
| 1752 |
This option specifies dash patterns for the normal state, the active |
| 1753 |
state, and the disabled state of an oval item. |
| 1754 |
I<pattern> may have any of the forms accepted by B<Tk_GetDash>. |
| 1755 |
If the dash options are omitted then the default is a solid outline. |
| 1756 |
|
| 1757 |
=item B<-dashoffset> =E<gt> I<offset> |
| 1758 |
|
| 1759 |
The starting I<offset> into the pattern provided by the |
| 1760 |
B<-dash> option. |
| 1761 |
B<-dashoffset> is ignored if there is no B<-dash> pattern. |
| 1762 |
|
| 1763 |
=item B<-fill> =E<gt> I<color> |
| 1764 |
|
| 1765 |
=item B<-activefill> =E<gt> I<color> |
| 1766 |
|
| 1767 |
=item B<-disabledfill> =E<gt> I<color> |
| 1768 |
|
| 1769 |
Specifies the color to be used to fill the oval in its normal, active, and |
| 1770 |
disabled states. |
| 1771 |
I<Color> may have any of the forms accepted by B<Tk_GetColor>. |
| 1772 |
If I<color> is undef (the default), then |
| 1773 |
then the oval will not be filled. |
| 1774 |
|
| 1775 |
=item B<-outline> =E<gt> I<color> |
| 1776 |
|
| 1777 |
=item B<-activeoutline> =E<gt> I<color> |
| 1778 |
|
| 1779 |
=item B<-disabledoutline> =E<gt> I<color> |
| 1780 |
|
| 1781 |
This option specifies the color that should be used to draw the |
| 1782 |
outline of the oval in its normal, active and disabled states. |
| 1783 |
I<Color> may have any of the forms accepted by B<Tk_GetColor>. |
| 1784 |
This option defaults to B<black>. |
| 1785 |
If I<color> is undef then no outline will be |
| 1786 |
drawn for the oval. |
| 1787 |
|
| 1788 |
=item B<-outlinestipple> =E<gt> I<bitmap> |
| 1789 |
|
| 1790 |
=item B<-activeoutlinestipple> =E<gt> I<bitmap> |
| 1791 |
|
| 1792 |
=item B<-disabledoutlinestipple> =E<gt> I<bitmap> |
| 1793 |
|
| 1794 |
This option specifies stipple patterns that should be used to draw the |
| 1795 |
outline of the oval in its normal, active and disabled states. |
| 1796 |
I<bitmap> specifies the stipple pattern to use, in any of the |
| 1797 |
forms accepted by B<Tk_GetBitmap>. |
| 1798 |
If the B<-outline> option hasn't been specified then this option |
| 1799 |
has no effect. |
| 1800 |
If I<bitmap> is an empty string (the default), then the outline is drawn |
| 1801 |
in a solid fashion. |
| 1802 |
|
| 1803 |
=item B<-state> =E<gt> I<state> |
| 1804 |
|
| 1805 |
Modifies the state of the oval item where I<state> may be set to one of: |
| 1806 |
normal, disabled, or hidden. An oval item may also be in the "active" |
| 1807 |
state if the mouse is currently over it. Many options can take |
| 1808 |
separate specifications in normal, active and disabled states such that the |
| 1809 |
appearance of the item can be different in each state. |
| 1810 |
|
| 1811 |
=item B<-stipple> =E<gt> I<bitmap> |
| 1812 |
|
| 1813 |
=item B<-activestipple> =E<gt> I<bitmap> |
| 1814 |
|
| 1815 |
=item B<-disabledstipple> =E<gt> I<bitmap> |
| 1816 |
|
| 1817 |
This option specifies stipple patterns that should be used to fill the |
| 1818 |
the oval in its normal, active and disabled states. |
| 1819 |
I<bitmap> specifies the stipple pattern to use, in any of the |
| 1820 |
forms accepted by B<Tk_GetBitmap>. |
| 1821 |
If the B<-fill> option hasn't been specified then this option |
| 1822 |
has no effect. |
| 1823 |
If I<bitmap> is an empty string (the default), then filling is done |
| 1824 |
in a solid fashion. |
| 1825 |
|
| 1826 |
=item B<-tags> =E<gt> I<tagList> |
| 1827 |
|
| 1828 |
Specifies a set of tags to apply to the item. |
| 1829 |
I<TagList> consists of a list of tag names, which replace any |
| 1830 |
existing tags for the item. |
| 1831 |
I<TagList> may be an empty list. |
| 1832 |
|
| 1833 |
=item B<-updatecommand> =E<gt> I<command> |
| 1834 |
|
| 1835 |
Specifies a callback that is to be executed every time |
| 1836 |
the oval item is updated on the screen. |
| 1837 |
|
| 1838 |
=item B<-width> =E<gt> I<outlineWidth> |
| 1839 |
|
| 1840 |
=item B<-activewidth> =E<gt> I<outlineWidth> |
| 1841 |
|
| 1842 |
=item B<-disabledwidth> =E<gt> I<outlineWidth> |
| 1843 |
|
| 1844 |
Specifies the width of the outline to be drawn around |
| 1845 |
the oval, in its normal, active and disabled states. |
| 1846 |
I<outlineWidth> specifies the width of the outline to be drawn around |
| 1847 |
the oval, in any of the forms described in the L<"COORDINATES"> section above. |
| 1848 |
|
| 1849 |
If the B<-outline> option hasn't been specified then this option |
| 1850 |
has no effect. |
| 1851 |
Wide outlines are drawn centered on the oval path defined by |
| 1852 |
I<x1>, I<y1>, I<x2>, and I<y2>. |
| 1853 |
This option defaults to 1.0. |
| 1854 |
|
| 1855 |
=back |
| 1856 |
|
| 1857 |
=head1 POLYGON ITEMS |
| 1858 |
|
| 1859 |
Items of type B<polygon> appear as polygonal or curved filled regions |
| 1860 |
on the display. |
| 1861 |
Polygon items support coordinate indexing operations using the canvas |
| 1862 |
methods: B<dchars, index, insert.> |
| 1863 |
Polygons are created with methods of the following form: |
| 1864 |
|
| 1865 |
$canvas->createPolygon(x1, y1, ..., xn, yn, ?option, value, option, value, ...?) |
| 1866 |
|
| 1867 |
The arguments I<x1> through I<yn> specify the coordinates for |
| 1868 |
three or more points that define a closed polygon. |
| 1869 |
The first and last points may be the same; whether they are or not, |
| 1870 |
Tk will draw the polygon as a closed polygon. |
| 1871 |
After the coordinates there may be any number of I<option>-I<value> |
| 1872 |
pairs, each of which sets one of the configuration options |
| 1873 |
for the item. These same I<option>-I<value> pairs may be |
| 1874 |
used in B<itemconfigure> methods to change the item's |
| 1875 |
configuration. |
| 1876 |
The following options are supported for polygons: |
| 1877 |
|
| 1878 |
=over 4 |
| 1879 |
|
| 1880 |
=item B<-dash> =E<gt> I<pattern> |
| 1881 |
|
| 1882 |
=item B<-activedash> =E<gt> I<pattern> |
| 1883 |
|
| 1884 |
=item B<-disableddash> =E<gt> I<pattern> |
| 1885 |
|
| 1886 |
This option specifies dash patterns for the normal state, the active |
| 1887 |
state, and the disabled state of an polygon item. |
| 1888 |
I<pattern> may have any of the forms accepted by B<Tk_GetDash>. |
| 1889 |
If the dash options are omitted then the default is a solid outline. |
| 1890 |
|
| 1891 |
=item B<-dashoffset> =E<gt> I<offset> |
| 1892 |
|
| 1893 |
The starting I<offset> into the pattern provided by the |
| 1894 |
B<-dash> option. |
| 1895 |
B<-dashoffset> is ignored if there is no B<-dash> pattern. |
| 1896 |
|
| 1897 |
=item B<-fill> =E<gt> I<color> |
| 1898 |
|
| 1899 |
=item B<-activefill> =E<gt> I<color> |
| 1900 |
|
| 1901 |
=item B<-disabledfill> =E<gt> I<color> |
| 1902 |
|
| 1903 |
Specifies the color to be used to fill the polygon in its normal, active, and |
| 1904 |
disabled states. |
| 1905 |
I<Color> |
| 1906 |
may have any of the forms acceptable to B<Tk_GetColor>. |
| 1907 |
If I<color> is undef then the polygon will be |
| 1908 |
transparent. |
| 1909 |
This option defaults to B<black>. |
| 1910 |
|
| 1911 |
=item B<-joinstyle> =E<gt> I<style> |
| 1912 |
|
| 1913 |
Specifies the ways in which joints are to be drawn at the vertices |
| 1914 |
of the outline. |
| 1915 |
I<Style> may have any of the forms accepted by B<Tk_GetCapStyle> |
| 1916 |
(B<bevel>, B<miter>, or B<round>). |
| 1917 |
If this option isn't specified then it defaults to B<miter>. |
| 1918 |
|
| 1919 |
=item B<-outline> =E<gt> I<color> |
| 1920 |
|
| 1921 |
=item B<-activeoutline> =E<gt> I<color> |
| 1922 |
|
| 1923 |
=item B<-disabledoutline> =E<gt> I<color> |
| 1924 |
|
| 1925 |
This option specifies the color that should be used to draw the |
| 1926 |
outline of the polygon in its normal, active and disabled states. |
| 1927 |
I<Color> may have any of the forms accepted by B<Tk_GetColor>. |
| 1928 |
If I<color> is undef then no outline will be |
| 1929 |
drawn for the polygon. |
| 1930 |
This option defaults to undef (no outline). |
| 1931 |
|
| 1932 |
=item B<-outlinestipple> =E<gt> I<bitmap> |
| 1933 |
|
| 1934 |
=item B<-activeoutlinestipple> =E<gt> I<bitmap> |
| 1935 |
|
| 1936 |
=item B<-disabledoutlinestipple> =E<gt> I<bitmap> |
| 1937 |
|
| 1938 |
This option specifies stipple patterns that should be used to draw the |
| 1939 |
outline of the polygon in its normal, active and disabled states. |
| 1940 |
I<bitmap> specifies the stipple pattern to use, in any of the |
| 1941 |
forms accepted by B<Tk_GetBitmap>. |
| 1942 |
If the B<-outline> option hasn't been specified then this option |
| 1943 |
has no effect. |
| 1944 |
If I<bitmap> is an empty string (the default), then the outline is drawn |
| 1945 |
in a solid fashion. |
| 1946 |
|
| 1947 |
=item B<-smooth> =E<gt> I<boolean> |
| 1948 |
|
| 1949 |
I<Boolean> must have one of the forms accepted by B<Tk_GetBoolean> |
| 1950 |
It indicates whether or not the polygon should be drawn with a |
| 1951 |
curved perimeter. |
| 1952 |
If so, the outline of the polygon becomes a set of parabolic splines, |
| 1953 |
one spline for the first and second line segments, one for the second |
| 1954 |
and third, and so on. Straight-line segments can be generated in a |
| 1955 |
smoothed polygon by duplicating the end-points of the desired line segment. |
| 1956 |
|
| 1957 |
=item B<-splinesteps> =E<gt> I<number> |
| 1958 |
|
| 1959 |
Specifies the degree of smoothness desired for curves: each spline |
| 1960 |
will be approximated with I<number> line segments. This |
| 1961 |
option is ignored unless the B<-smooth> option is true. |
| 1962 |
|
| 1963 |
=item B<-state> =E<gt> I<state> |
| 1964 |
|
| 1965 |
Modifies the state of the polygon item where I<state> may be set to one of: |
| 1966 |
normal, disabled, or hidden. A polygon item may also be in the "active" |
| 1967 |
state if the mouse is currently over it. Many options can take |
| 1968 |
separate specifications in normal, active and disabled states such that the |
| 1969 |
appearance of the item can be different in each state. |
| 1970 |
|
| 1971 |
=item B<-stipple> =E<gt> I<bitmap> |
| 1972 |
|
| 1973 |
=item B<-activestipple> =E<gt> I<bitmap> |
| 1974 |
|
| 1975 |
=item B<-disabledstipple> =E<gt> I<bitmap> |
| 1976 |
|
| 1977 |
This option specifies stipple patterns that should be used to fill the |
| 1978 |
the polygon in its normal, active and disabled states. |
| 1979 |
I<bitmap> specifies the stipple pattern to use, in any of the |
| 1980 |
forms accepted by B<Tk_GetBitmap>. |
| 1981 |
If I<bitmap> is an empty string (the default), then filling is |
| 1982 |
done in a solid fashion. |
| 1983 |
|
| 1984 |
=item B<-tags> =E<gt> I<tagList> |
| 1985 |
|
| 1986 |
Specifies a set of tags to apply to the item. |
| 1987 |
I<TagList> consists of a list of tag names, which replace any |
| 1988 |
existing tags for the item. |
| 1989 |
I<TagList> may be an empty list. |
| 1990 |
|
| 1991 |
=item B<-updatecommand> =E<gt> I<command> |
| 1992 |
|
| 1993 |
Specifies a callback that is to be executed every time |
| 1994 |
the polygon item is updated on the screen. |
| 1995 |
|
| 1996 |
=item B<-width> =E<gt> I<outlineWidth> |
| 1997 |
|
| 1998 |
=item B<-activewidth> =E<gt> I<outlineWidth> |
| 1999 |
|
| 2000 |
=item B<-disabledwidth> =E<gt> I<outlineWidth> |
| 2001 |
|
| 2002 |
=item Specifies the width of the outline to be drawn around |
| 2003 |
|
| 2004 |
the polygon, in its normal, active and disabled states. |
| 2005 |
I<outlineWidth> may be in any of the forms described in the COORDINATES |
| 2006 |
section above. |
| 2007 |
I<OutlineWidth> specifies the width of the outline to be drawn around |
| 2008 |
the polygon, in any of the forms described in the L<"COORDINATES"> section above. |
| 2009 |
If the B<-outline> option hasn't been specified then this option |
| 2010 |
has no effect. This option defaults to 1.0. |
| 2011 |
|
| 2012 |
Polygon items are different from other items such as rectangles, ovals |
| 2013 |
and arcs in that interior points are considered to be ``inside'' a |
| 2014 |
polygon (e.g. for purposes of the B<find closest> and |
| 2015 |
B<find overlapping> methods) even if it is not filled. |
| 2016 |
For most other item types, an |
| 2017 |
interior point is considered to be inside the item only if the item |
| 2018 |
is filled or if it has neither a fill nor an outline. If you would |
| 2019 |
like an unfilled polygon whose interior points are not considered |
| 2020 |
to be inside the polygon, use a line item instead. |
| 2021 |
|
| 2022 |
=back |
| 2023 |
|
| 2024 |
=head1 RECTANGLE ITEMS |
| 2025 |
|
| 2026 |
Items of type B<rectangle> appear as rectangular regions on |
| 2027 |
the display. Each rectangle may have an outline, a fill, or |
| 2028 |
both. Rectangles are created with methods of the |
| 2029 |
following form: |
| 2030 |
|
| 2031 |
$canvas->createRectangle(x1, y1, x2, y2, ?option, value, option, value, ...?) |
| 2032 |
|
| 2033 |
The arguments I<x1>, I<y1>, I<x2>, and I<y2> give |
| 2034 |
the coordinates of two diagonally opposite corners of the rectangle |
| 2035 |
(the rectangle will include its upper and left edges but not |
| 2036 |
its lower or right edges). |
| 2037 |
After the coordinates there may be any number of I<option>-I<value> |
| 2038 |
pairs, each of which sets one of the configuration options |
| 2039 |
for the item. These same I<option>-I<value> pairs may be |
| 2040 |
used in B<itemconfigure> methods to change the item's |
| 2041 |
configuration. |
| 2042 |
The following options are supported for rectangles: |
| 2043 |
|
| 2044 |
=over 4 |
| 2045 |
|
| 2046 |
=item B<-dash> =E<gt> I<pattern> |
| 2047 |
|
| 2048 |
=item B<-activedash> =E<gt> I<pattern> |
| 2049 |
|
| 2050 |
=item B<-disableddash> =E<gt> I<pattern> |
| 2051 |
|
| 2052 |
This option specifies dash patterns for the normal state, the active |
| 2053 |
state, and the disabled state of a rectangle item. |
| 2054 |
I<pattern> may have any of the forms accepted by B<Tk_GetDash>. |
| 2055 |
If the dash options are omitted then the default is a solid outline. |
| 2056 |
|
| 2057 |
=item B<-dashoffset> =E<gt> I<offset> |
| 2058 |
|
| 2059 |
The starting I<offset> into the pattern provided by the |
| 2060 |
B<-dash> option. |
| 2061 |
B<-dashoffset> is ignored if there is no B<-dash> pattern. |
| 2062 |
|
| 2063 |
=item B<-fill> =E<gt> I<color> |
| 2064 |
|
| 2065 |
=item B<-activefill> =E<gt> I<color> |
| 2066 |
|
| 2067 |
=item B<-disabledfill> =E<gt> I<color> |
| 2068 |
|
| 2069 |
Specifies the color to be used to fill the rectangle in its normal, active, and |
| 2070 |
disabled states. |
| 2071 |
I<Color> |
| 2072 |
may be specified in any of the forms accepted by B<Tk_GetColor>. |
| 2073 |
If I<color> is undef (the default), |
| 2074 |
then the rectangle will not be filled. |
| 2075 |
|
| 2076 |
=item B<-outline> =E<gt> I<color> |
| 2077 |
|
| 2078 |
=item B<-activeoutline> =E<gt> I<color> |
| 2079 |
|
| 2080 |
=item B<-disabledoutline> =E<gt> I<color> |
| 2081 |
|
| 2082 |
This option specifies the color that should be used to draw the |
| 2083 |
outline of the rectangle in its normal, active and disabled states. |
| 2084 |
I<Color> may have any of the forms accepted by B<Tk_GetColor>. |
| 2085 |
This option defaults to B<black>. |
| 2086 |
If I<color> is undef then no outline will be |
| 2087 |
drawn for the rectangle. |
| 2088 |
|
| 2089 |
=item B<-outlinestipple> =E<gt> I<bitmap> |
| 2090 |
|
| 2091 |
=item B<-activeoutlinestipple> =E<gt> I<bitmap> |
| 2092 |
|
| 2093 |
=item B<-disabledoutlinestipple> =E<gt> I<bitmap> |
| 2094 |
|
| 2095 |
This option specifies stipple patterns that should be used to draw the |
| 2096 |
outline of the rectangle in its normal, active and disabled states. |
| 2097 |
I<bitmap> specifies the stipple pattern to use, in any of the |
| 2098 |
forms accepted by B<Tk_GetBitmap>. |
| 2099 |
If the B<-outline> option hasn't been specified then this option |
| 2100 |
has no effect. |
| 2101 |
If I<bitmap> is an empty string (the default), then the outline is drawn |
| 2102 |
in a solid fashion. |
| 2103 |
|
| 2104 |
=item B<-state> =E<gt> I<state> |
| 2105 |
|
| 2106 |
Modifies the state of the rectangle item where I<state> may be set to one of: |
| 2107 |
normal, disabled, or hidden. A rectangle item may also be in the "active" |
| 2108 |
state if the mouse is currently over it. Many options can take |
| 2109 |
separate specifications in normal, active and disabled states such that the |
| 2110 |
appearance of the item can be different in each state. |
| 2111 |
|
| 2112 |
=item B<-stipple> =E<gt> I<bitmap> |
| 2113 |
|
| 2114 |
=item B<-activestipple> =E<gt> I<bitmap> |
| 2115 |
|
| 2116 |
=item B<-disabledstipple> =E<gt> I<bitmap> |
| 2117 |
|
| 2118 |
This option specifies stipple patterns that should be used to fill the |
| 2119 |
the rectangle in its normal, active and disabled states. |
| 2120 |
I<bitmap> specifies the stipple pattern to use, in any of the |
| 2121 |
forms accepted by B<Tk_GetBitmap>. |
| 2122 |
If the B<-fill> option hasn't been specified then this option |
| 2123 |
has no effect. |
| 2124 |
If I<bitmap> is an empty string (the default), then filling |
| 2125 |
is done in a solid fashion. |
| 2126 |
|
| 2127 |
=item B<-tags> =E<gt> I<tagList> |
| 2128 |
|
| 2129 |
Specifies a set of tags to apply to the item. |
| 2130 |
I<TagList> consists of a list of tag names, which replace any |
| 2131 |
existing tags for the item. |
| 2132 |
I<TagList> may be an empty list. |
| 2133 |
|
| 2134 |
=item B<-updatecommand> =E<gt> I<command> |
| 2135 |
|
| 2136 |
Specifies a callback that is to be executed every time |
| 2137 |
the rectangle item is updated on the screen. |
| 2138 |
|
| 2139 |
=item B<-width> =E<gt> I<outlineWidth> |
| 2140 |
|
| 2141 |
=item B<-activewidth> =E<gt> I<outlineWidth> |
| 2142 |
|
| 2143 |
=item B<-disabledwidth> =E<gt> I<outlineWidth> |
| 2144 |
|
| 2145 |
Specifies the width of the outline to be drawn around |
| 2146 |
the rectangle, in its normal, active and disabled states. |
| 2147 |
I<OutlineWidth> specifies the width of the outline to be drawn around |
| 2148 |
the rectangle, in any of the forms described in the L<"COORDINATES"> section above. |
| 2149 |
|
| 2150 |
If the B<-outline> option hasn't been specified then this option |
| 2151 |
has no effect. |
| 2152 |
Wide outlines are drawn centered on the rectangular path |
| 2153 |
defined by I<x1>, I<y1>, I<x2>, and I<y2>. |
| 2154 |
This option defaults to 1.0. |
| 2155 |
|
| 2156 |
=back |
| 2157 |
|
| 2158 |
=head1 TEXT ITEMS |
| 2159 |
|
| 2160 |
A text item displays a string of characters on the screen in one |
| 2161 |
or more lines. |
| 2162 |
Text items support indexing and selection, along with the |
| 2163 |
following text-related canvas methods: B<dchars>, |
| 2164 |
B<focus>, B<icursor>, B<index>, B<insert>, |
| 2165 |
B<select>. |
| 2166 |
Text items are created with methods of the following |
| 2167 |
form: |
| 2168 |
|
| 2169 |
$canvas->createText(x, y, ?option, value, option, value, ...?) |
| 2170 |
|
| 2171 |
The arguments I<x> and I<y> specify the coordinates of a |
| 2172 |
point used to position the text on the display (see the options |
| 2173 |
below for more information on how text is displayed). |
| 2174 |
After the coordinates there may be any number of I<option>-I<value> |
| 2175 |
pairs, each of which sets one of the configuration options |
| 2176 |
for the item. These same I<option>-I<value> pairs may be |
| 2177 |
used in B<itemconfigure> methods to change the item's |
| 2178 |
configuration. |
| 2179 |
The following options are supported for text items: |
| 2180 |
|
| 2181 |
=over 4 |
| 2182 |
|
| 2183 |
=item B<-anchor> =E<gt> I<anchorPos> |
| 2184 |
|
| 2185 |
I<AnchorPos> tells how to position the text relative to the |
| 2186 |
positioning point for the text; it may have any of the forms |
| 2187 |
accepted by B<Tk_GetAnchor>. For example, if I<anchorPos> |
| 2188 |
is B<center> then the text is centered on the point; if |
| 2189 |
I<anchorPos> is B<n> then the text will be drawn such that |
| 2190 |
the top center point of the rectangular region occupied by the |
| 2191 |
text will be at the positioning point. |
| 2192 |
This option defaults to B<center>. |
| 2193 |
|
| 2194 |
=item B<-fill> =E<gt> I<color> |
| 2195 |
|
| 2196 |
=item B<-activefill> =E<gt> I<color> |
| 2197 |
|
| 2198 |
=item B<-disabledfill> =E<gt> I<color> |
| 2199 |
|
| 2200 |
Specifies the color to be used to fill the text in its normal, active, and |
| 2201 |
disabled states. |
| 2202 |
I<Color> may have any of the forms accepted by B<Tk_GetColor>. |
| 2203 |
If I<color> is undef then the text will be transparent. |
| 2204 |
If this option isn't specified then it defaults to B<black>. |
| 2205 |
|
| 2206 |
=item B<-font> =E<gt> I<fontName> |
| 2207 |
|
| 2208 |
Specifies the font to use for the text item. |
| 2209 |
I<FontName> may be any string acceptable to B<Tk_GetFontStruct>. |
| 2210 |
If this option isn't specified, it defaults to a system-dependent |
| 2211 |
font. |
| 2212 |
|
| 2213 |
=item B<-justify> =E<gt> I<how> |
| 2214 |
|
| 2215 |
Specifies how to justify the text within its bounding region. |
| 2216 |
I<How> must be one of the values B<left>, B<right>, |
| 2217 |
or B<center>. |
| 2218 |
This option will only matter if the text is displayed as multiple |
| 2219 |
lines. |
| 2220 |
If the option is omitted, it defaults to B<left>. |
| 2221 |
|
| 2222 |
=item B<-state> =E<gt> I<state> |
| 2223 |
|
| 2224 |
Modifies the state of the text item where I<state> may be set to one of: |
| 2225 |
normal, disabled, or hidden. A text item may also be in the "active" |
| 2226 |
state if the mouse is currently over it. Many options can take |
| 2227 |
separate specifications in normal, active and disabled states such that the |
| 2228 |
appearance of the item can be different in each state. |
| 2229 |
|
| 2230 |
=item B<-stipple> =E<gt> I<bitmap> |
| 2231 |
|
| 2232 |
=item B<-activestipple> =E<gt> I<bitmap> |
| 2233 |
|
| 2234 |
=item B<-disabledstipple> =E<gt> I<bitmap> |
| 2235 |
|
| 2236 |
This option specifies stipple patterns that should be used to fill the |
| 2237 |
the text in its normal, active and disabled states. |
| 2238 |
I<bitmap> specifies the stipple pattern to use, in any of the |
| 2239 |
forms accepted by B<Tk_GetBitmap>. |
| 2240 |
If I<bitmap> is an empty string (the default) then the text |
| 2241 |
is drawn in a solid fashion. |
| 2242 |
|
| 2243 |
=item B<-tags> =E<gt> I<tagList> |
| 2244 |
|
| 2245 |
Specifies a set of tags to apply to the item. |
| 2246 |
I<TagList> consists of a list of tag names, which replace any |
| 2247 |
existing tags for the item. |
| 2248 |
I<TagList> may be an empty list. |
| 2249 |
|
| 2250 |
=item B<-text> =E<gt> I<string> |
| 2251 |
|
| 2252 |
I<String> specifies the characters to be displayed in the text item. |
| 2253 |
Newline characters cause line breaks. |
| 2254 |
The characters in the item may also be changed with the |
| 2255 |
B<insert> and B<delete> methods. |
| 2256 |
This option defaults to an empty string. |
| 2257 |
|
| 2258 |
=item B<-updatecommand> =E<gt> I<command> |
| 2259 |
|
| 2260 |
Specifies a callback that is to be executed every time |
| 2261 |
the text item is updated on the screen. |
| 2262 |
|
| 2263 |
=item B<-width> =E<gt> I<lineLength> |
| 2264 |
|
| 2265 |
Specifies a maximum line length for the text, in any of the forms |
| 2266 |
described in the L<"COORDINATES"> section above. |
| 2267 |
If this option is zero (the default) the text is broken into |
| 2268 |
lines only at newline characters. |
| 2269 |
However, if this option is non-zero then any line that would |
| 2270 |
be longer than I<lineLength> is broken just before a space |
| 2271 |
character to make the line shorter than I<lineLength>; the |
| 2272 |
space character is treated as if it were a newline |
| 2273 |
character. |
| 2274 |
|
| 2275 |
=back |
| 2276 |
|
| 2277 |
=head1 WINDOW ITEMS |
| 2278 |
|
| 2279 |
Items of type B<window> cause a particular window to be displayed |
| 2280 |
at a given position on the canvas. |
| 2281 |
Window items are created with methods of the following form: |
| 2282 |
|
| 2283 |
S< >I<$canvas>->B<createWindow>(I<x, y>?, I<-option>=>I<value>, I<-option>=>I<value>, ...?) |
| 2284 |
|
| 2285 |
The arguments I<x> and I<y> specify the coordinates of a |
| 2286 |
point used to position the window on the display (see the B<-anchor> |
| 2287 |
option below for more information on how bitmaps are displayed). |
| 2288 |
After the coordinates there may be any number of I<option-value> |
| 2289 |
pairs, each of which sets one of the configuration options |
| 2290 |
for the item. These same I<option>-I<value> pairs may be |
| 2291 |
used in B<itemconfigure> method to change the item's |
| 2292 |
configuration. |
| 2293 |
The following options are supported for window items: |
| 2294 |
|
| 2295 |
=over 4 |
| 2296 |
|
| 2297 |
=item B<-anchor> =E<gt> I<anchorPos> |
| 2298 |
|
| 2299 |
I<AnchorPos> tells how to position the window relative to the |
| 2300 |
positioning point for the item; it may have any of the forms |
| 2301 |
accepted by B<Tk_GetAnchor>. For example, if I<anchorPos> |
| 2302 |
is B<center> then the window is centered on the point; if |
| 2303 |
I<anchorPos> is B<n> then the window will be drawn so that |
| 2304 |
its top center point is at the positioning point. |
| 2305 |
This option defaults to B<center>. |
| 2306 |
|
| 2307 |
=item B<-height> =E<gt> I<pixels> |
| 2308 |
|
| 2309 |
Specifies the height to assign to the item's window. |
| 2310 |
I<Pixels> may have any of the |
| 2311 |
forms described in the L<"COORDINATES"> section above. |
| 2312 |
If this option isn't specified, or if it is specified as an empty |
| 2313 |
string, then the window is given whatever height it requests internally. |
| 2314 |
|
| 2315 |
=item B<-state> =E<gt> I<state> |
| 2316 |
|
| 2317 |
Modifies the state of the window item where I<state> may be set to one of: |
| 2318 |
normal, disabled, or hidden. |
| 2319 |
|
| 2320 |
=item B<-tags> =E<gt> I<tagList> |
| 2321 |
|
| 2322 |
Specifies a set of tags to apply to the item. |
| 2323 |
I<TagList> consists of a list of tag names, which replace any |
| 2324 |
existing tags for the item. |
| 2325 |
I<TagList> may be an empty list. |
| 2326 |
|
| 2327 |
=item B<-updatecommand> =E<gt> I<command> |
| 2328 |
|
| 2329 |
Specifies a callback that is to be executed every time |
| 2330 |
the window item is updated on the screen. |
| 2331 |
|
| 2332 |
=item B<-width> =E<gt> I<pixels> |
| 2333 |
|
| 2334 |
Specifies the width to assign to the item's window. |
| 2335 |
I<Pixels> may have any of the |
| 2336 |
forms described in the L<"COORDINATES"> section above. |
| 2337 |
If this option isn't specified, or if it is specified as an empty |
| 2338 |
string, then the window is given whatever width it requests internally. |
| 2339 |
|
| 2340 |
=item B<-window> =E<gt> I<$widget> |
| 2341 |
|
| 2342 |
Specifies the window to associate with this item. |
| 2343 |
The window specified by $widget must either be a child of |
| 2344 |
the canvas widget or a child of some ancestor of the canvas widget. |
| 2345 |
I<PathName> may not refer to a top-level window. |
| 2346 |
|
| 2347 |
Note: due to restrictions in the ways that windows are managed, it is not |
| 2348 |
possible to draw other graphical items (such as lines and images) on top |
| 2349 |
of window items. A window item always obscures any graphics that |
| 2350 |
overlap it, regardless of their order in the display list. |
| 2351 |
|
| 2352 |
=back |
| 2353 |
|
| 2354 |
=head1 APPLICATION-DEFINED ITEM TYPES |
| 2355 |
|
| 2356 |
It is possible for individual applications to define new item |
| 2357 |
types for canvas widgets using C code. |
| 2358 |
See the documentation for B<Tk_CreateItemType>. |
| 2359 |
|
| 2360 |
=head1 BINDINGS |
| 2361 |
|
| 2362 |
Canvas has default bindings to allow scrolling if necessary: |
| 2363 |
<Up>, <Down>, <Left> and <Right> (and their <Control-*> counter |
| 2364 |
parts). Further <Proir>, <Next>, <Home> and <End>. These |
| 2365 |
bindings allow you to navigate the same way as in other |
| 2366 |
widgets that can scroll. |
| 2367 |
|
| 2368 |
=head1 Perl/Tk Methods |
| 2369 |
|
| 2370 |
The following methods are added as perl code: |
| 2371 |
|
| 2372 |
=over 4 |
| 2373 |
|
| 2374 |
=item $canvas->get_corners |
| 2375 |
|
| 2376 |
Returns the bounding box in Canvas coordinates of the visible portion |
| 2377 |
of the Canvas. (Written by Slaven Rezic.) |
| 2378 |
|
| 2379 |
=back |
| 2380 |
|
| 2381 |
=head1 CREDITS |
| 2382 |
|
| 2383 |
Tk's canvas widget is a blatant ripoff of ideas from Joel Bartlett's |
| 2384 |
I<ezd> program. I<Ezd> provides structured graphics in a Scheme |
| 2385 |
environment and preceded canvases by a year or two. Its simple |
| 2386 |
mechanisms for placing and animating graphical objects inspired the |
| 2387 |
functions of canvases. |
| 2388 |
|
| 2389 |
=head1 KEYWORDS |
| 2390 |
|
| 2391 |
canvas, widget |
| 2392 |
|
| 2393 |
=cut |
| 2394 |
|