Commit | Line | Data |
---|---|---|
920dae64 AT |
1 | '\" |
2 | '\" Copyright (c) 1992-1994 The Regents of the University of California. | |
3 | '\" Copyright (c) 1994-1996 Sun Microsystems, Inc. | |
4 | '\" Copyright (c) 1997-1999 Scriptics Corporation. | |
5 | '\" | |
6 | '\" See the file "license.terms" for information on usage and redistribution | |
7 | '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. | |
8 | '\" | |
9 | '\" RCS: @(#) $Id: canvas.n,v 1.13.2.2 2005/05/12 22:50:59 dgp Exp $ | |
10 | '\" | |
11 | '\" The definitions below are for supplemental macros used in Tcl/Tk | |
12 | '\" manual entries. | |
13 | '\" | |
14 | '\" .AP type name in/out ?indent? | |
15 | '\" Start paragraph describing an argument to a library procedure. | |
16 | '\" type is type of argument (int, etc.), in/out is either "in", "out", | |
17 | '\" or "in/out" to describe whether procedure reads or modifies arg, | |
18 | '\" and indent is equivalent to second arg of .IP (shouldn't ever be | |
19 | '\" needed; use .AS below instead) | |
20 | '\" | |
21 | '\" .AS ?type? ?name? | |
22 | '\" Give maximum sizes of arguments for setting tab stops. Type and | |
23 | '\" name are examples of largest possible arguments that will be passed | |
24 | '\" to .AP later. If args are omitted, default tab stops are used. | |
25 | '\" | |
26 | '\" .BS | |
27 | '\" Start box enclosure. From here until next .BE, everything will be | |
28 | '\" enclosed in one large box. | |
29 | '\" | |
30 | '\" .BE | |
31 | '\" End of box enclosure. | |
32 | '\" | |
33 | '\" .CS | |
34 | '\" Begin code excerpt. | |
35 | '\" | |
36 | '\" .CE | |
37 | '\" End code excerpt. | |
38 | '\" | |
39 | '\" .VS ?version? ?br? | |
40 | '\" Begin vertical sidebar, for use in marking newly-changed parts | |
41 | '\" of man pages. The first argument is ignored and used for recording | |
42 | '\" the version when the .VS was added, so that the sidebars can be | |
43 | '\" found and removed when they reach a certain age. If another argument | |
44 | '\" is present, then a line break is forced before starting the sidebar. | |
45 | '\" | |
46 | '\" .VE | |
47 | '\" End of vertical sidebar. | |
48 | '\" | |
49 | '\" .DS | |
50 | '\" Begin an indented unfilled display. | |
51 | '\" | |
52 | '\" .DE | |
53 | '\" End of indented unfilled display. | |
54 | '\" | |
55 | '\" .SO | |
56 | '\" Start of list of standard options for a Tk widget. The | |
57 | '\" options follow on successive lines, in four columns separated | |
58 | '\" by tabs. | |
59 | '\" | |
60 | '\" .SE | |
61 | '\" End of list of standard options for a Tk widget. | |
62 | '\" | |
63 | '\" .OP cmdName dbName dbClass | |
64 | '\" Start of description of a specific option. cmdName gives the | |
65 | '\" option's name as specified in the class command, dbName gives | |
66 | '\" the option's name in the option database, and dbClass gives | |
67 | '\" the option's class in the option database. | |
68 | '\" | |
69 | '\" .UL arg1 arg2 | |
70 | '\" Print arg1 underlined, then print arg2 normally. | |
71 | '\" | |
72 | '\" RCS: @(#) $Id: man.macros,v 1.4 2000/08/25 06:18:32 ericm Exp $ | |
73 | '\" | |
74 | '\" # Set up traps and other miscellaneous stuff for Tcl/Tk man pages. | |
75 | .if t .wh -1.3i ^B | |
76 | .nr ^l \n(.l | |
77 | .ad b | |
78 | '\" # Start an argument description | |
79 | .de AP | |
80 | .ie !"\\$4"" .TP \\$4 | |
81 | .el \{\ | |
82 | . ie !"\\$2"" .TP \\n()Cu | |
83 | . el .TP 15 | |
84 | .\} | |
85 | .ta \\n()Au \\n()Bu | |
86 | .ie !"\\$3"" \{\ | |
87 | \&\\$1 \\fI\\$2\\fP (\\$3) | |
88 | .\".b | |
89 | .\} | |
90 | .el \{\ | |
91 | .br | |
92 | .ie !"\\$2"" \{\ | |
93 | \&\\$1 \\fI\\$2\\fP | |
94 | .\} | |
95 | .el \{\ | |
96 | \&\\fI\\$1\\fP | |
97 | .\} | |
98 | .\} | |
99 | .. | |
100 | '\" # define tabbing values for .AP | |
101 | .de AS | |
102 | .nr )A 10n | |
103 | .if !"\\$1"" .nr )A \\w'\\$1'u+3n | |
104 | .nr )B \\n()Au+15n | |
105 | .\" | |
106 | .if !"\\$2"" .nr )B \\w'\\$2'u+\\n()Au+3n | |
107 | .nr )C \\n()Bu+\\w'(in/out)'u+2n | |
108 | .. | |
109 | .AS Tcl_Interp Tcl_CreateInterp in/out | |
110 | '\" # BS - start boxed text | |
111 | '\" # ^y = starting y location | |
112 | '\" # ^b = 1 | |
113 | .de BS | |
114 | .br | |
115 | .mk ^y | |
116 | .nr ^b 1u | |
117 | .if n .nf | |
118 | .if n .ti 0 | |
119 | .if n \l'\\n(.lu\(ul' | |
120 | .if n .fi | |
121 | .. | |
122 | '\" # BE - end boxed text (draw box now) | |
123 | .de BE | |
124 | .nf | |
125 | .ti 0 | |
126 | .mk ^t | |
127 | .ie n \l'\\n(^lu\(ul' | |
128 | .el \{\ | |
129 | .\" Draw four-sided box normally, but don't draw top of | |
130 | .\" box if the box started on an earlier page. | |
131 | .ie !\\n(^b-1 \{\ | |
132 | \h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul' | |
133 | .\} | |
134 | .el \}\ | |
135 | \h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul' | |
136 | .\} | |
137 | .\} | |
138 | .fi | |
139 | .br | |
140 | .nr ^b 0 | |
141 | .. | |
142 | '\" # VS - start vertical sidebar | |
143 | '\" # ^Y = starting y location | |
144 | '\" # ^v = 1 (for troff; for nroff this doesn't matter) | |
145 | .de VS | |
146 | .if !"\\$2"" .br | |
147 | .mk ^Y | |
148 | .ie n 'mc \s12\(br\s0 | |
149 | .el .nr ^v 1u | |
150 | .. | |
151 | '\" # VE - end of vertical sidebar | |
152 | .de VE | |
153 | .ie n 'mc | |
154 | .el \{\ | |
155 | .ev 2 | |
156 | .nf | |
157 | .ti 0 | |
158 | .mk ^t | |
159 | \h'|\\n(^lu+3n'\L'|\\n(^Yu-1v\(bv'\v'\\n(^tu+1v-\\n(^Yu'\h'-|\\n(^lu+3n' | |
160 | .sp -1 | |
161 | .fi | |
162 | .ev | |
163 | .\} | |
164 | .nr ^v 0 | |
165 | .. | |
166 | '\" # Special macro to handle page bottom: finish off current | |
167 | '\" # box/sidebar if in box/sidebar mode, then invoked standard | |
168 | '\" # page bottom macro. | |
169 | .de ^B | |
170 | .ev 2 | |
171 | 'ti 0 | |
172 | 'nf | |
173 | .mk ^t | |
174 | .if \\n(^b \{\ | |
175 | .\" Draw three-sided box if this is the box's first page, | |
176 | .\" draw two sides but no top otherwise. | |
177 | .ie !\\n(^b-1 \h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\h'|0u'\c | |
178 | .el \h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\h'|0u'\c | |
179 | .\} | |
180 | .if \\n(^v \{\ | |
181 | .nr ^x \\n(^tu+1v-\\n(^Yu | |
182 | \kx\h'-\\nxu'\h'|\\n(^lu+3n'\ky\L'-\\n(^xu'\v'\\n(^xu'\h'|0u'\c | |
183 | .\} | |
184 | .bp | |
185 | 'fi | |
186 | .ev | |
187 | .if \\n(^b \{\ | |
188 | .mk ^y | |
189 | .nr ^b 2 | |
190 | .\} | |
191 | .if \\n(^v \{\ | |
192 | .mk ^Y | |
193 | .\} | |
194 | .. | |
195 | '\" # DS - begin display | |
196 | .de DS | |
197 | .RS | |
198 | .nf | |
199 | .sp | |
200 | .. | |
201 | '\" # DE - end display | |
202 | .de DE | |
203 | .fi | |
204 | .RE | |
205 | .sp | |
206 | .. | |
207 | '\" # SO - start of list of standard options | |
208 | .de SO | |
209 | .SH "STANDARD OPTIONS" | |
210 | .LP | |
211 | .nf | |
212 | .ta 5.5c 11c | |
213 | .ft B | |
214 | .. | |
215 | '\" # SE - end of list of standard options | |
216 | .de SE | |
217 | .fi | |
218 | .ft R | |
219 | .LP | |
220 | See the \\fBoptions\\fR manual entry for details on the standard options. | |
221 | .. | |
222 | '\" # OP - start of full description for a single option | |
223 | .de OP | |
224 | .LP | |
225 | .nf | |
226 | .ta 4c | |
227 | Command-Line Name: \\fB\\$1\\fR | |
228 | Database Name: \\fB\\$2\\fR | |
229 | Database Class: \\fB\\$3\\fR | |
230 | .fi | |
231 | .IP | |
232 | .. | |
233 | '\" # CS - begin code excerpt | |
234 | .de CS | |
235 | .RS | |
236 | .nf | |
237 | .ta .25i .5i .75i 1i | |
238 | .. | |
239 | '\" # CE - end code excerpt | |
240 | .de CE | |
241 | .fi | |
242 | .RE | |
243 | .. | |
244 | .de UL | |
245 | \\$1\l'|0\(ul'\\$2 | |
246 | .. | |
247 | .TH canvas n 8.3 Tk "Tk Built-In Commands" | |
248 | .BS | |
249 | '\" Note: do not modify the .SH NAME line immediately below! | |
250 | .SH NAME | |
251 | canvas \- Create and manipulate canvas widgets | |
252 | .SH SYNOPSIS | |
253 | \fBcanvas\fR \fIpathName \fR?\fIoptions\fR? | |
254 | .SO | |
255 | \-background \-insertborderwidth \-selectborderwidth | |
256 | \-borderwidth \-insertofftime \-selectforeground | |
257 | \-cursor \-insertontime \-takefocus | |
258 | \-highlightbackground \-insertwidth \-xscrollcommand | |
259 | \-highlightcolor \-relief \-yscrollcommand | |
260 | \-highlightthickness \-state | |
261 | \-insertbackground \-selectbackground | |
262 | .SE | |
263 | .SH "WIDGET-SPECIFIC OPTIONS" | |
264 | .OP \-closeenough closeEnough CloseEnough | |
265 | Specifies a floating-point value indicating how close the mouse cursor | |
266 | must be to an item before it is considered to be ``inside'' the item. | |
267 | Defaults to 1.0. | |
268 | .OP \-confine confine Confine | |
269 | Specifies a boolean value that indicates whether or not it should be | |
270 | allowable to set the canvas's view outside the region defined by the | |
271 | \fBscrollRegion\fR argument. | |
272 | Defaults to true, which means that the view will | |
273 | be constrained within the scroll region. | |
274 | .OP \-height height Height | |
275 | Specifies a desired window height that the canvas widget should request from | |
276 | its geometry manager. The value may be specified in any | |
277 | of the forms described in the \fBCOORDINATES\fR section below. | |
278 | .OP \-scrollregion scrollRegion ScrollRegion | |
279 | Specifies a list with four coordinates describing the left, top, right, and | |
280 | bottom coordinates of a rectangular region. | |
281 | This region is used for scrolling purposes and is considered to be | |
282 | the boundary of the information in the canvas. | |
283 | Each of the coordinates may be specified | |
284 | in any of the forms given in the \fBCOORDINATES\fR section below. | |
285 | .OP \-state state State | |
286 | Modifies the default state of the canvas where \fIstate\fR may be set to | |
287 | one of: \fBnormal\fR, \fBdisabled\fR, or \fBhidden\fR. Individual canvas | |
288 | objects all have their own state option which may override the default | |
289 | state. Many options can take separate specifications such that the | |
290 | appearance of the item can be different in different situations. The | |
291 | options that start with \fBactive\fR control the appearence when the mouse | |
292 | pointer is over it, while the option starting with \fBdisabled\fR controls | |
293 | the appearence when the state is disabled. Canvas items which are | |
294 | \fBdisabled\fR will not react to canvas bindings. | |
295 | .OP \-width width width | |
296 | Specifies a desired window width that the canvas widget should request from | |
297 | its geometry manager. The value may be specified in any | |
298 | of the forms described in the \fBCOORDINATES\fR section below. | |
299 | .OP \-xscrollincrement xScrollIncrement ScrollIncrement | |
300 | Specifies an increment for horizontal scrolling, in any of the usual forms | |
301 | permitted for screen distances. If the value of this option is greater | |
302 | than zero, the horizontal view in the window will be constrained so that | |
303 | the canvas x coordinate at the left edge of the window is always an even | |
304 | multiple of \fBxScrollIncrement\fR; furthermore, the units for scrolling | |
305 | (e.g., the change in view when the left and right arrows of a scrollbar | |
306 | are selected) will also be \fBxScrollIncrement\fR. If the value of | |
307 | this option is less than or equal to zero, then horizontal scrolling | |
308 | is unconstrained. | |
309 | .OP \-yscrollincrement yScrollIncrement ScrollIncrement | |
310 | Specifies an increment for vertical scrolling, in any of the usual forms | |
311 | permitted for screen distances. If the value of this option is greater | |
312 | than zero, the vertical view in the window will be constrained so that | |
313 | the canvas y coordinate at the top edge of the window is always an even | |
314 | multiple of \fByScrollIncrement\fR; furthermore, the units for scrolling | |
315 | (e.g., the change in view when the top and bottom arrows of a scrollbar | |
316 | are selected) will also be \fByScrollIncrement\fR. If the value of | |
317 | this option is less than or equal to zero, then vertical scrolling | |
318 | is unconstrained. | |
319 | .BE | |
320 | ||
321 | .SH INTRODUCTION | |
322 | .PP | |
323 | The \fBcanvas\fR command creates a new window (given | |
324 | by the \fIpathName\fR argument) and makes it into a canvas widget. | |
325 | Additional options, described above, may be specified on the | |
326 | command line or in the option database | |
327 | to configure aspects of the canvas such as its colors and 3-D relief. | |
328 | The \fBcanvas\fR command returns its | |
329 | \fIpathName\fR argument. At the time this command is invoked, | |
330 | there must not exist a window named \fIpathName\fR, but | |
331 | \fIpathName\fR's parent must exist. | |
332 | .PP | |
333 | Canvas widgets implement structured graphics. | |
334 | A canvas displays any number of \fIitems\fR, which may be things like | |
335 | rectangles, circles, lines, and text. | |
336 | Items may be manipulated (e.g. moved or re-colored) and commands may | |
337 | be associated with items in much the same way that the \fBbind\fR | |
338 | command allows commands to be bound to widgets. For example, | |
339 | a particular command may be associated with the <Button-1> event | |
340 | so that the command is invoked whenever button 1 is pressed with | |
341 | the mouse cursor over an item. | |
342 | This means that items in a canvas can have behaviors defined by | |
343 | the Tcl scripts bound to them. | |
344 | .SH "DISPLAY LIST" | |
345 | .PP | |
346 | The items in a canvas are ordered for purposes of display, | |
347 | with the first item in the display list being displayed | |
348 | first, followed by the next item in the list, and so on. | |
349 | Items later in the display list obscure those that are | |
350 | earlier in the display list and are sometimes referred to | |
351 | as being ``on top'' of earlier items. | |
352 | When a new item is created it is placed at the end of the | |
353 | display list, on top of everything else. | |
354 | Widget commands may be used to re-arrange the order of the | |
355 | display list. | |
356 | .PP | |
357 | Window items are an exception to the above rules. The underlying | |
358 | window systems require them always to be drawn on top of other items. | |
359 | In addition, the stacking order of window items | |
360 | is not affected by any of the canvas widget commands; you must use | |
361 | the \fBraise\fR and \fBlower\fR Tk commands instead. | |
362 | .SH "ITEM IDS AND TAGS" | |
363 | .PP | |
364 | Items in a canvas widget may be named in either of two ways: | |
365 | by id or by tag. | |
366 | Each item has a unique identifying number, which is assigned to | |
367 | that item when it is created. The id of an item never changes | |
368 | and id numbers are never re-used within the lifetime of a | |
369 | canvas widget. | |
370 | .PP | |
371 | Each item may also have any number of \fItags\fR associated | |
372 | with it. A tag is just a string of characters, and it may | |
373 | take any form except that of an integer. | |
374 | For example, ``x123'' is OK but ``123'' isn't. | |
375 | The same tag may be associated with many different items. | |
376 | This is commonly done to group items in various interesting | |
377 | ways; for example, all selected items might be given the | |
378 | tag ``selected''. | |
379 | .PP | |
380 | The tag \fBall\fR is implicitly associated with every item | |
381 | in the canvas; it may be used to invoke operations on | |
382 | all the items in the canvas. | |
383 | .PP | |
384 | The tag \fBcurrent\fR is managed automatically by Tk; | |
385 | it applies to the \fIcurrent item\fR, which is the | |
386 | topmost item whose drawn area covers the position of | |
387 | the mouse cursor. | |
388 | If the mouse is not in the canvas widget or is not over | |
389 | an item, then no item has the \fBcurrent\fR tag. | |
390 | .PP | |
391 | When specifying items in canvas widget commands, if the | |
392 | specifier is an integer then it is assumed to refer to | |
393 | the single item with that id. | |
394 | If the specifier is not an integer, then it is assumed to | |
395 | refer to all of the items in the canvas that have a tag | |
396 | matching the specifier. | |
397 | The symbol \fItagOrId\fR is used below to indicate that | |
398 | an argument specifies either an id that selects a single | |
399 | item or a tag that selects zero or more items. | |
400 | .PP | |
401 | \fItagOrId\fR may contain a logical expressions of | |
402 | tags by using operators: '&&', '||', '^' '!', and parenthesized | |
403 | subexpressions. For example: | |
404 | .CS | |
405 | .c find withtag {(a&&!b)||(!a&&b)} | |
406 | .CE | |
407 | or equivalently: | |
408 | .CS | |
409 | .c find withtag {a^b} | |
410 | .CE | |
411 | will find only those items with either "a" or "b" tags, but not both. | |
412 | .PP | |
413 | Some widget commands only operate on a single item at a | |
414 | time; if \fItagOrId\fR is specified in a way that | |
415 | names multiple items, then the normal behavior is for | |
416 | the command to use the first (lowest) of these items in | |
417 | the display list that is suitable for the command. | |
418 | Exceptions are noted in the widget command descriptions | |
419 | below. | |
420 | .SH "COORDINATES" | |
421 | .PP | |
422 | All coordinates related to canvases are stored as floating-point | |
423 | numbers. | |
424 | Coordinates and distances are specified in screen units, | |
425 | which are floating-point numbers optionally followed | |
426 | by one of several letters. | |
427 | If no letter is supplied then the distance is in pixels. | |
428 | If the letter is \fBm\fR then the distance is in millimeters on | |
429 | the screen; if it is \fBc\fR then the distance is in centimeters; | |
430 | \fBi\fR means inches, and \fBp\fR means printers points (1/72 inch). | |
431 | Larger y-coordinates refer to points lower on the screen; larger | |
432 | x-coordinates refer to points farther to the right. | |
433 | .VS | |
434 | Coordinates can be specified either as an even number of parameters, | |
435 | or as a single list parameter containing an even number of x and y | |
436 | coordinate values. | |
437 | .VE | |
438 | .SH TRANSFORMATIONS | |
439 | .PP | |
440 | Normally the origin of the canvas coordinate system is at the | |
441 | upper-left corner of the window containing the canvas. | |
442 | It is possible to adjust the origin of the canvas | |
443 | coordinate system relative to the origin of the window using the | |
444 | \fBxview\fR and \fByview\fR widget commands; this is typically used | |
445 | for scrolling. | |
446 | Canvases do not support scaling or rotation of the canvas coordinate | |
447 | system relative to the window coordinate system. | |
448 | .PP | |
449 | Individual items may be moved or scaled using widget commands | |
450 | described below, but they may not be rotated. | |
451 | .PP | |
452 | Note that the default origin of the canvas's visible area is | |
453 | coincident with the origin for the whole window as that makes bindings | |
454 | using the mouse position easier to work with; you only need to use the | |
455 | \fBcanvasx\fR and \fBcanvasy\fR widget commands if you adjust the | |
456 | origin of the visible area. However, this also means that any focus | |
457 | ring (as controlled by the \fB\-highlightthickness\fR option) and | |
458 | window border (as controlled by the \fB\-borderwidth\fR option) must | |
459 | be taken into account before you get to the visible area of the | |
460 | canvas. | |
461 | .SH "INDICES" | |
462 | .PP | |
463 | Text items support the notion of an \fIindex\fR for identifying | |
464 | particular positions within the item. | |
465 | In a similar fashion, line and polygon items support \fIindex\fR for | |
466 | identifying, inserting and deleting subsets of their coordinates. | |
467 | Indices are used for commands such as inserting or deleting | |
468 | a range of characters or coordinates, and setting the insertion | |
469 | cursor position. An index may be specified in any of a number | |
470 | of ways, and different types of items may support different forms | |
471 | for specifying indices. | |
472 | Text items support the following forms for an index; if you | |
473 | define new types of text-like items, it would be advisable to | |
474 | support as many of these forms as practical. | |
475 | Note that it is possible to refer to the character just after | |
476 | the last one in the text item; this is necessary for such | |
477 | tasks as inserting new text at the end of the item. | |
478 | Lines and Polygons don't support the insertion cursor | |
479 | and the selection. Their indices are supposed to be even | |
480 | always, because coordinates always appear in pairs. | |
481 | .TP 10 | |
482 | \fInumber\fR | |
483 | A decimal number giving the position of the desired character | |
484 | within the text item. | |
485 | 0 refers to the first character, 1 to the next character, and | |
486 | so on. If indexes are odd for lines and polygons, they will be | |
487 | automatically decremented by one. | |
488 | A number less than 0 is treated as if it were zero, and a | |
489 | number greater than the length of the text item is treated | |
490 | as if it were equal to the length of the text item. For | |
491 | polygons, numbers less than 0 or greater then the length | |
492 | of the coordinate list will be adjusted by adding or subtracting | |
493 | the length until the result is between zero and the length, | |
494 | inclusive. | |
495 | .TP 10 | |
496 | \fBend\fR | |
497 | Refers to the character or coordinate just after the last one | |
498 | in the item (same as the number of characters or coordinates | |
499 | in the item). | |
500 | .TP 10 | |
501 | \fBinsert\fR | |
502 | Refers to the character just before which the insertion cursor | |
503 | is drawn in this item. Not valid for lines and polygons. | |
504 | .TP 10 | |
505 | \fBsel.first\fR | |
506 | Refers to the first selected character in the item. | |
507 | If the selection isn't in this item then this form is illegal. | |
508 | .TP 10 | |
509 | \fBsel.last\fR | |
510 | Refers to the last selected character in the item. | |
511 | If the selection isn't in this item then this form is illegal. | |
512 | .TP 10 | |
513 | \fB@\fIx,y\fR | |
514 | Refers to the character or coordinate at the point given by \fIx\fR and | |
515 | \fIy\fR, where \fIx\fR and \fIy\fR are specified in the coordinate | |
516 | system of the canvas. | |
517 | If \fIx\fR and \fIy\fR lie outside the coordinates covered by the | |
518 | text item, then they refer to the first or last character in the | |
519 | line that is closest to the given point. | |
520 | .SH "DASH PATTERNS" | |
521 | .PP | |
522 | Many items support the notion of a dash pattern for outlines. | |
523 | .PP | |
524 | The first possible syntax is a list of integers. Each element | |
525 | represents the number of pixels of a line segment. Only the odd | |
526 | segments are drawn using the "outline" color. The other segments | |
527 | are drawn transparent. | |
528 | .PP | |
529 | The second possible syntax is a character list containing only | |
530 | 5 possible characters \fB[.,-_ ]\fR. The space can be used | |
531 | to enlarge the space between other line elements, and can not | |
532 | occur as the first position in the string. Some examples: | |
533 | -dash . = -dash {2 4} | |
534 | -dash - = -dash {6 4} | |
535 | -dash -. = -dash {6 4 2 4} | |
536 | -dash -.. = -dash {6 4 2 4 2 4} | |
537 | -dash {. } = -dash {2 8} | |
538 | -dash , = -dash {4 4} | |
539 | .PP | |
540 | The main difference of this syntax with the previous is that it | |
541 | is shape-conserving. This means that all values in the dash | |
542 | list will be multiplied by the line width before display. This | |
543 | assures that "." will always be displayed as a dot and "-" | |
544 | always as a dash regardless of the line width. | |
545 | .PP | |
546 | On systems which support only a limited set of dash patterns, the dash | |
547 | pattern will be displayed as the closest dash pattern that is available. | |
548 | For example, on Windows only the first 4 of the above examples are | |
549 | available. The last 2 examples will be displayed identically to the first | |
550 | one. | |
551 | .SH "WIDGET COMMAND" | |
552 | .PP | |
553 | The \fBcanvas\fR command creates a new Tcl command whose | |
554 | name is \fIpathName\fR. This | |
555 | command may be used to invoke various | |
556 | operations on the widget. It has the following general form: | |
557 | .CS | |
558 | \fIpathName option \fR?\fIarg arg ...\fR? | |
559 | .CE | |
560 | \fIOption\fR and the \fIarg\fRs | |
561 | determine the exact behavior of the command. | |
562 | The following widget commands are possible for canvas widgets: | |
563 | .TP | |
564 | \fIpathName \fBaddtag \fItag searchSpec \fR?\fIarg arg ...\fR? | |
565 | For each item that meets the constraints specified by | |
566 | \fIsearchSpec\fR and the \fIarg\fRs, add | |
567 | \fItag\fR to the list of tags associated with the item if it | |
568 | isn't already present on that list. | |
569 | It is possible that no items will satisfy the constraints | |
570 | given by \fIsearchSpec\fR and \fIarg\fRs, in which case the | |
571 | command has no effect. | |
572 | This command returns an empty string as result. | |
573 | \fISearchSpec\fR and \fIarg\fR's may take any of the following | |
574 | forms: | |
575 | .RS | |
576 | .TP | |
577 | \fBabove \fItagOrId\fR | |
578 | Selects the item just after (above) the one given by \fItagOrId\fR | |
579 | in the display list. | |
580 | If \fItagOrId\fR denotes more than one item, then the last (topmost) | |
581 | of these items in the display list is used. | |
582 | .TP | |
583 | \fBall\fR | |
584 | Selects all the items in the canvas. | |
585 | .TP | |
586 | \fBbelow \fItagOrId\fR | |
587 | Selects the item just before (below) the one given by \fItagOrId\fR | |
588 | in the display list. | |
589 | If \fItagOrId\fR denotes more than one item, then the first (lowest) | |
590 | of these items in the display list is used. | |
591 | .TP | |
592 | \fBclosest \fIx y \fR?\fIhalo\fR? ?\fIstart\fR? | |
593 | Selects the item closest to the point given by \fIx\fR and \fIy\fR. | |
594 | If more than one item is at the same closest distance (e.g. two | |
595 | items overlap the point), then the top-most of these items (the | |
596 | last one in the display list) is used. | |
597 | If \fIhalo\fR is specified, then it must be a non-negative | |
598 | value. | |
599 | Any item closer than \fIhalo\fR to the point is considered to | |
600 | overlap it. | |
601 | The \fIstart\fR argument may be used to step circularly through | |
602 | all the closest items. | |
603 | If \fIstart\fR is specified, it names an item using a tag or id | |
604 | (if by tag, it selects the first item in the display list with | |
605 | the given tag). | |
606 | Instead of selecting the topmost closest item, this form will | |
607 | select the topmost closest item that is below \fIstart\fR in | |
608 | the display list; if no such item exists, then the selection | |
609 | behaves as if the \fIstart\fR argument had not been specified. | |
610 | .TP | |
611 | \fBenclosed\fR \fIx1\fR \fIy1\fR \fIx2\fR \fIy2\fR | |
612 | Selects all the items completely enclosed within the rectangular | |
613 | region given by \fIx1\fR, \fIy1\fR, \fIx2\fR, and \fIy2\fR. | |
614 | \fIX1\fR must be no greater then \fIx2\fR and \fIy1\fR must be | |
615 | no greater than \fIy2\fR. | |
616 | .TP | |
617 | \fBoverlapping\fR \fIx1\fR \fIy1\fR \fIx2\fR \fIy2\fR | |
618 | Selects all the items that overlap or are enclosed within the | |
619 | rectangular region given by \fIx1\fR, \fIy1\fR, \fIx2\fR, | |
620 | and \fIy2\fR. | |
621 | \fIX1\fR must be no greater then \fIx2\fR and \fIy1\fR must be | |
622 | no greater than \fIy2\fR. | |
623 | .TP | |
624 | \fBwithtag \fItagOrId\fR | |
625 | Selects all the items given by \fItagOrId\fR. | |
626 | .RE | |
627 | .TP | |
628 | \fIpathName \fBbbox \fItagOrId\fR ?\fItagOrId tagOrId ...\fR? | |
629 | Returns a list with four elements giving an approximate bounding box | |
630 | for all the items named by the \fItagOrId\fR arguments. | |
631 | The list has the form ``\fIx1 y1 x2 y2\fR'' such that the drawn | |
632 | areas of all the named elements are within the region bounded by | |
633 | \fIx1\fR on the left, \fIx2\fR on the right, \fIy1\fR on the top, | |
634 | and \fIy2\fR on the bottom. | |
635 | The return value may overestimate the actual bounding box by | |
636 | a few pixels. | |
637 | If no items match any of the \fItagOrId\fR arguments or if the | |
638 | matching items have empty bounding boxes (i.e. they have nothing | |
639 | to display) | |
640 | then an empty string is returned. | |
641 | .TP | |
642 | \fIpathName \fBbind \fItagOrId\fR ?\fIsequence\fR? ?\fIcommand\fR? | |
643 | This command associates \fIcommand\fR with all the items given by | |
644 | \fItagOrId\fR such that whenever the event sequence given by | |
645 | \fIsequence\fR occurs for one of the items the command will | |
646 | be invoked. | |
647 | This widget command is similar to the \fBbind\fR command except that | |
648 | it operates on items in a canvas rather than entire widgets. | |
649 | See the \fBbind\fR manual entry for complete details | |
650 | on the syntax of \fIsequence\fR and the substitutions performed | |
651 | on \fIcommand\fR before invoking it. | |
652 | If all arguments are specified then a new binding is created, replacing | |
653 | any existing binding for the same \fIsequence\fR and \fItagOrId\fR | |
654 | (if the first character of \fIcommand\fR is ``+'' then \fIcommand\fR | |
655 | augments an existing binding rather than replacing it). | |
656 | In this case the return value is an empty string. | |
657 | If \fIcommand\fR is omitted then the command returns the \fIcommand\fR | |
658 | associated with \fItagOrId\fR and \fIsequence\fR (an error occurs | |
659 | if there is no such binding). | |
660 | If both \fIcommand\fR and \fIsequence\fR are omitted then the command | |
661 | returns a list of all the sequences for which bindings have been | |
662 | defined for \fItagOrId\fR. | |
663 | .RS | |
664 | .PP | |
665 | The only events for which bindings may be specified are those related to | |
666 | the mouse and keyboard (such as \fBEnter\fR, \fBLeave\fR, | |
667 | \fBButtonPress\fR, \fBMotion\fR, and \fBKeyPress\fR) or virtual events. | |
668 | The handling of events in canvases uses the current item defined in ITEM | |
669 | IDS AND TAGS above. \fBEnter\fR and \fBLeave\fR events trigger for an | |
670 | item when it becomes the current item or ceases to be the current item; | |
671 | note that these events are different than \fBEnter\fR and \fBLeave\fR | |
672 | events for windows. Mouse-related events are directed to the current | |
673 | item, if any. Keyboard-related events are directed to the focus item, if | |
674 | any (see the \fBfocus\fR widget command below for more on this). If a | |
675 | virtual event is used in a binding, that binding can trigger only if the | |
676 | virtual event is defined by an underlying mouse-related or | |
677 | keyboard-related event. | |
678 | .PP | |
679 | It is possible for multiple bindings to match a particular event. | |
680 | This could occur, for example, if one binding is associated with the | |
681 | item's id and another is associated with one of the item's tags. | |
682 | When this occurs, all of the matching bindings are invoked. | |
683 | A binding associated with the \fBall\fR tag is invoked first, | |
684 | followed by one binding for each of the item's tags (in order), | |
685 | followed by a binding associated with the item's id. | |
686 | If there are multiple matching bindings for a single tag, | |
687 | then only the most specific binding is invoked. | |
688 | A \fBcontinue\fR command in a binding script terminates that | |
689 | script, and a \fBbreak\fR command terminates that script | |
690 | and skips any remaining scripts for the event, just as for the | |
691 | \fBbind\fR command. | |
692 | .PP | |
693 | If bindings have been created for a canvas window using the \fBbind\fR | |
694 | command, then they are invoked in addition to bindings created for | |
695 | the canvas's items using the \fBbind\fR widget command. | |
696 | The bindings for items will be invoked before any of the bindings | |
697 | for the window as a whole. | |
698 | .RE | |
699 | .TP | |
700 | \fIpathName \fBcanvasx \fIscreenx\fR ?\fIgridspacing\fR? | |
701 | Given a window x-coordinate in the canvas \fIscreenx\fR, this command returns | |
702 | the canvas x-coordinate that is displayed at that location. | |
703 | If \fIgridspacing\fR is specified, then the canvas coordinate is | |
704 | rounded to the nearest multiple of \fIgridspacing\fR units. | |
705 | .TP | |
706 | \fIpathName \fBcanvasy \fIscreeny\fR ?\fIgridspacing\fR? | |
707 | Given a window y-coordinate in the canvas \fIscreeny\fR this command returns | |
708 | the canvas y-coordinate that is displayed at that location. | |
709 | If \fIgridspacing\fR is specified, then the canvas coordinate is | |
710 | rounded to the nearest multiple of \fIgridspacing\fR units. | |
711 | .TP | |
712 | \fIpathName \fBcget\fR \fIoption\fR | |
713 | Returns the current value of the configuration option given | |
714 | by \fIoption\fR. | |
715 | \fIOption\fR may have any of the values accepted by the \fBcanvas\fR | |
716 | command. | |
717 | .TP | |
718 | \fIpathName \fBconfigure ?\fIoption\fR? ?\fIvalue\fR? ?\fIoption value ...\fR? | |
719 | Query or modify the configuration options of the widget. | |
720 | If no \fIoption\fR is specified, returns a list describing all of | |
721 | the available options for \fIpathName\fR (see \fBTk_ConfigureInfo\fR for | |
722 | information on the format of this list). If \fIoption\fR is specified | |
723 | with no \fIvalue\fR, then the command returns a list describing the | |
724 | one named option (this list will be identical to the corresponding | |
725 | sublist of the value returned if no \fIoption\fR is specified). If | |
726 | one or more \fIoption\-value\fR pairs are specified, then the command | |
727 | modifies the given widget option(s) to have the given value(s); in | |
728 | this case the command returns an empty string. | |
729 | \fIOption\fR may have any of the values accepted by the \fBcanvas\fR | |
730 | command. | |
731 | .TP | |
732 | \fIpathName\fR \fBcoords \fItagOrId \fR?\fIx0 y0 ...\fR? | |
733 | .TP | |
734 | \fIpathName\fR \fBcoords \fItagOrId \fR?\fIcoordList\fR? | |
735 | Query or modify the coordinates that define an item. | |
736 | If no coordinates are specified, this command returns a list | |
737 | whose elements are the coordinates of the item named by | |
738 | \fItagOrId\fR. | |
739 | If coordinates are specified, then they replace the current | |
740 | coordinates for the named item. | |
741 | If \fItagOrId\fR refers to multiple items, then | |
742 | the first one in the display list is used. | |
743 | .TP | |
744 | \fIpathName \fBcreate \fItype x y \fR?\fIx y ...\fR? ?\fIoption value ...\fR? | |
745 | .TP | |
746 | \fIpathName \fBcreate \fItype coordList \fR?\fIoption value ...\fR? | |
747 | Create a new item in \fIpathName\fR of type \fItype\fR. | |
748 | The exact format of the arguments after \fBtype\fR depends | |
749 | on \fBtype\fR, but usually they consist of the coordinates for | |
750 | one or more points, followed by specifications for zero or | |
751 | more item options. | |
752 | See the subsections on individual item types below for more | |
753 | on the syntax of this command. | |
754 | This command returns the id for the new item. | |
755 | .TP | |
756 | \fIpathName \fBdchars \fItagOrId first \fR?\fIlast\fR? | |
757 | For each item given by \fItagOrId\fR, delete the characters, or coordinates, | |
758 | in the range given by \fIfirst\fR and \fIlast\fR, inclusive. | |
759 | If some of the items given by \fItagOrId\fR don't support | |
760 | indexing operations then they ignore dchars. | |
761 | Text items interpret \fIfirst\fR and \fIlast\fR as indices to a character, | |
762 | line and polygon items interpret them indices to a coordinate (an x,y pair). | |
763 | Indices are described in INDICES above. | |
764 | If \fIlast\fR is omitted, it defaults to \fIfirst\fR. | |
765 | This command returns an empty string. | |
766 | .TP | |
767 | \fIpathName \fBdelete \fR?\fItagOrId tagOrId ...\fR? | |
768 | Delete each of the items given by each \fItagOrId\fR, and return | |
769 | an empty string. | |
770 | .TP | |
771 | \fIpathName \fBdtag \fItagOrId \fR?\fItagToDelete\fR? | |
772 | For each of the items given by \fItagOrId\fR, delete the | |
773 | tag given by \fItagToDelete\fR from the list of those | |
774 | associated with the item. | |
775 | If an item doesn't have the tag \fItagToDelete\fR then | |
776 | the item is unaffected by the command. | |
777 | If \fItagToDelete\fR is omitted then it defaults to \fItagOrId\fR. | |
778 | This command returns an empty string. | |
779 | .TP | |
780 | \fIpathName \fBfind \fIsearchCommand \fR?\fIarg arg ...\fR? | |
781 | This command returns a list consisting of all the items that | |
782 | meet the constraints specified by \fIsearchCommand\fR and | |
783 | \fIarg\fR's. | |
784 | \fISearchCommand\fR and \fIargs\fR have any of the forms | |
785 | accepted by the \fBaddtag\fR command. | |
786 | The items are returned in stacking order, with the lowest item first. | |
787 | .TP | |
788 | \fIpathName \fBfocus \fR?\fItagOrId\fR? | |
789 | Set the keyboard focus for the canvas widget to the item given by | |
790 | \fItagOrId\fR. | |
791 | If \fItagOrId\fR refers to several items, then the focus is set | |
792 | to the first such item in the display list that supports the | |
793 | insertion cursor. | |
794 | If \fItagOrId\fR doesn't refer to any items, or if none of them | |
795 | support the insertion cursor, then the focus isn't changed. | |
796 | If \fItagOrId\fR is an empty | |
797 | string, then the focus item is reset so that no item has the focus. | |
798 | If \fItagOrId\fR is not specified then the command returns the | |
799 | id for the item that currently has the focus, or an empty string | |
800 | if no item has the focus. | |
801 | .RS | |
802 | .PP | |
803 | Once the focus has been set to an item, the item will display | |
804 | the insertion cursor and all keyboard events will be directed | |
805 | to that item. | |
806 | The focus item within a canvas and the focus window on the | |
807 | screen (set with the \fBfocus\fR command) are totally independent: | |
808 | a given item doesn't actually have the input focus unless (a) | |
809 | its canvas is the focus window and (b) the item is the focus item | |
810 | within the canvas. | |
811 | In most cases it is advisable to follow the \fBfocus\fR widget | |
812 | command with the \fBfocus\fR command to set the focus window to | |
813 | the canvas (if it wasn't there already). | |
814 | .RE | |
815 | .TP | |
816 | \fIpathName \fBgettags\fR \fItagOrId\fR | |
817 | Return a list whose elements are the tags associated with the | |
818 | item given by \fItagOrId\fR. | |
819 | If \fItagOrId\fR refers to more than one item, then the tags | |
820 | are returned from the first such item in the display list. | |
821 | If \fItagOrId\fR doesn't refer to any items, or if the item | |
822 | contains no tags, then an empty string is returned. | |
823 | .TP | |
824 | \fIpathName \fBicursor \fItagOrId index\fR | |
825 | Set the position of the insertion cursor for the item(s) given by \fItagOrId\fR | |
826 | to just before the character whose position is given by \fIindex\fR. | |
827 | If some or all of the items given by \fItagOrId\fR don't support | |
828 | an insertion cursor then this command has no effect on them. | |
829 | See INDICES above for a description of the | |
830 | legal forms for \fIindex\fR. | |
831 | Note: the insertion cursor is only displayed in an item if | |
832 | that item currently has the keyboard focus (see the widget | |
833 | command \fBfocus\fR, below), but the cursor position may | |
834 | be set even when the item doesn't have the focus. | |
835 | This command returns an empty string. | |
836 | .TP | |
837 | \fIpathName \fBindex \fItagOrId index\fR | |
838 | This command returns a decimal string giving the numerical index | |
839 | within \fItagOrId\fR corresponding to \fIindex\fR. | |
840 | \fIIndex\fR gives a textual description of the desired position | |
841 | as described in INDICES above. | |
842 | Text items interpret \fIindex\fR as an index to a character, | |
843 | line and polygon items interpret it as an index to a coordinate (an x,y pair). | |
844 | The return value is guaranteed to lie between 0 and the number | |
845 | of characters, or coordinates, within the item, inclusive. | |
846 | If \fItagOrId\fR refers to multiple items, then the index | |
847 | is processed in the first of these items that supports indexing | |
848 | operations (in display list order). | |
849 | .TP | |
850 | \fIpathName \fBinsert \fItagOrId beforeThis string\fR | |
851 | For each of the items given by \fItagOrId\fR, if the item supports | |
852 | text or coordinate, insertion then \fIstring\fR is inserted into the item's | |
853 | text just before the character, or coordinate, whose index is \fIbeforeThis\fR. | |
854 | Text items interpret \fIbeforeThis\fR as an index to a character, | |
855 | line and polygon items interpret it as an index to a coordinate (an x,y pair). | |
856 | For lines and polygons the \fIstring\fR must be a valid coordinate | |
857 | sequence. | |
858 | See INDICES above for information about the forms allowed | |
859 | for \fIbeforeThis\fR. | |
860 | This command returns an empty string. | |
861 | .TP | |
862 | \fIpathName \fBitemcget\fR \fItagOrId\fR \fIoption\fR | |
863 | Returns the current value of the configuration option for the | |
864 | item given by \fItagOrId\fR whose name is \fIoption\fR. | |
865 | This command is similar to the \fBcget\fR widget command except that | |
866 | it applies to a particular item rather than the widget as a whole. | |
867 | \fIOption\fR may have any of the values accepted by the \fBcreate\fR | |
868 | widget command when the item was created. | |
869 | If \fItagOrId\fR is a tag that refers to more than one item, | |
870 | the first (lowest) such item is used. | |
871 | .TP | |
872 | \fIpathName \fBitemconfigure \fItagOrId\fR ?\fIoption\fR? ?\fIvalue\fR? ?\fIoption value ...\fR? | |
873 | This command is similar to the \fBconfigure\fR widget command except | |
874 | that it modifies item-specific options for the items given by | |
875 | \fItagOrId\fR instead of modifying options for the overall | |
876 | canvas widget. | |
877 | If no \fIoption\fR is specified, returns a list describing all of | |
878 | the available options for the first item given by \fItagOrId\fR | |
879 | (see \fBTk_ConfigureInfo\fR for | |
880 | information on the format of this list). If \fIoption\fR is specified | |
881 | with no \fIvalue\fR, then the command returns a list describing the | |
882 | one named option (this list will be identical to the corresponding | |
883 | sublist of the value returned if no \fIoption\fR is specified). If | |
884 | one or more \fIoption\-value\fR pairs are specified, then the command | |
885 | modifies the given widget option(s) to have the given value(s) in | |
886 | each of the items given by \fItagOrId\fR; in | |
887 | this case the command returns an empty string. | |
888 | The \fIoption\fRs and \fIvalue\fRs are the same as those permissible | |
889 | in the \fBcreate\fR widget command when the item(s) were created; | |
890 | see the sections describing individual item types below for details | |
891 | on the legal options. | |
892 | .TP | |
893 | \fIpathName \fBlower \fItagOrId \fR?\fIbelowThis\fR? | |
894 | Move all of the items given by \fItagOrId\fR to a new position | |
895 | in the display list just before the item given by \fIbelowThis\fR. | |
896 | If \fItagOrId\fR refers to more than one item then all are moved | |
897 | but the relative order of the moved items will not be changed. | |
898 | \fIBelowThis\fR is a tag or id; if it refers to more than one | |
899 | item then the first (lowest) of these items in the display list is used | |
900 | as the destination location for the moved items. | |
901 | Note: this command has no effect on window items. Window items always | |
902 | obscure other item types, and the stacking order of window items is | |
903 | determined by the \fBraise\fR and \fBlower\fR commands, not the | |
904 | \fBraise\fR and \fBlower\fR widget commands for canvases. | |
905 | This command returns an empty string. | |
906 | .TP | |
907 | \fIpathName \fBmove \fItagOrId xAmount yAmount\fR | |
908 | Move each of the items given by \fItagOrId\fR in the canvas coordinate | |
909 | space by adding \fIxAmount\fR to the x-coordinate of each point | |
910 | associated with the item and \fIyAmount\fR to the y-coordinate of | |
911 | each point associated with the item. | |
912 | This command returns an empty string. | |
913 | .TP | |
914 | \fIpathName \fBpostscript \fR?\fIoption value option value ...\fR? | |
915 | Generate a Postscript representation for part or all of the canvas. | |
916 | If the \fB\-file\fR option is specified then the Postscript is written | |
917 | to a file and an empty string is returned; otherwise the Postscript | |
918 | is returned as the result of the command. | |
919 | If the interpreter that owns the canvas is marked as safe, the operation | |
920 | will fail because safe interpreters are not allowed to write files. | |
921 | If the \fB\-channel\fR option is specified, the argument denotes the name | |
922 | of a channel already opened for writing. The Postscript is written to | |
923 | that channel, and the channel is left open for further writing at the end | |
924 | of the operation. | |
925 | The Postscript is created in Encapsulated Postscript form using | |
926 | version 3.0 of the Document Structuring Conventions. | |
927 | Note: by default Postscript is only generated for information that | |
928 | appears in the canvas's window on the screen. If the canvas is | |
929 | freshly created it may still have its initial size of 1x1 pixel | |
930 | so nothing will appear in the Postscript. To get around this problem | |
931 | either invoke the "update" command to wait for the canvas window | |
932 | to reach its final size, or else use the \fB\-width\fR and \fB\-height\fR | |
933 | options to specify the area of the canvas to print. | |
934 | The \fIoption\fR\-\fIvalue\fR argument pairs provide additional | |
935 | information to control the generation of Postscript. The following | |
936 | options are supported: | |
937 | .RS | |
938 | .TP | |
939 | \fB\-colormap \fIvarName\fR | |
940 | \fIVarName\fR must be the name of an array variable | |
941 | that specifies a color mapping to use in the Postscript. | |
942 | Each element of \fIvarName\fR must consist of Postscript | |
943 | code to set a particular color value (e.g. ``\fB1.0 1.0 0.0 setrgbcolor\fR''). | |
944 | When outputting color information in the Postscript, Tk checks | |
945 | to see if there is an element of \fIvarName\fR with the same | |
946 | name as the color. | |
947 | If so, Tk uses the value of the element as the Postscript command | |
948 | to set the color. | |
949 | If this option hasn't been specified, or if there isn't an entry | |
950 | in \fIvarName\fR for a given color, then Tk uses the red, green, | |
951 | and blue intensities from the X color. | |
952 | .TP | |
953 | \fB\-colormode \fImode\fR | |
954 | Specifies how to output color information. \fIMode\fR must be either | |
955 | \fBcolor\fR (for full color output), \fBgray\fR (convert all colors | |
956 | to their gray-scale equivalents) or \fBmono\fR (convert all colors | |
957 | to black or white). | |
958 | .TP | |
959 | \fB\-file \fIfileName\fR | |
960 | Specifies the name of the file in which to write the Postscript. | |
961 | If this option isn't specified then the Postscript is returned as the | |
962 | result of the command instead of being written to a file. | |
963 | .TP | |
964 | \fB\-fontmap \fIvarName\fR | |
965 | \fIVarName\fR must be the name of an array variable | |
966 | that specifies a font mapping to use in the Postscript. | |
967 | Each element of \fIvarName\fR must consist of a Tcl list with | |
968 | two elements, which are the name and point size of a Postscript font. | |
969 | When outputting Postscript commands for a particular font, Tk | |
970 | checks to see if \fIvarName\fR contains an element with the same | |
971 | name as the font. | |
972 | If there is such an element, then the font information contained in | |
973 | that element is used in the Postscript. | |
974 | Otherwise Tk attempts to guess what Postscript font to use. | |
975 | Tk's guesses generally only work for well-known fonts such as | |
976 | Times and Helvetica and Courier, and only if the X font name does not | |
977 | omit any dashes up through the point size. | |
978 | For example, \fB\-*\-Courier\-Bold\-R\-Normal\-\-*\-120\-*\fR will work but | |
979 | \fB*Courier\-Bold\-R\-Normal*120*\fR will not; Tk needs the dashes to | |
980 | parse the font name). | |
981 | .TP | |
982 | \fB\-height \fIsize\fR | |
983 | Specifies the height of the area of the canvas to print. | |
984 | Defaults to the height of the canvas window. | |
985 | .TP | |
986 | \fB\-pageanchor \fIanchor\fR | |
987 | Specifies which point of the printed area of the canvas should appear over | |
988 | the positioning point on the page (which is given by the \fB\-pagex\fR | |
989 | and \fB\-pagey\fR options). | |
990 | For example, \fB\-pageanchor n\fR means that the top center of the | |
991 | area of the canvas being printed (as it appears in the canvas window) | |
992 | should be over the positioning point. Defaults to \fBcenter\fR. | |
993 | .TP | |
994 | \fB\-pageheight \fIsize\fR | |
995 | Specifies that the Postscript should be scaled in both x and y so | |
996 | that the printed area is \fIsize\fR high on the Postscript page. | |
997 | \fISize\fR consists of a floating-point number followed by | |
998 | \fBc\fR for centimeters, \fBi\fR for inches, \fBm\fR for millimeters, | |
999 | or \fBp\fR or nothing for printer's points (1/72 inch). | |
1000 | Defaults to the height of the printed area on the screen. | |
1001 | If both \fB\-pageheight\fR and \fB\-pagewidth\fR are specified then | |
1002 | the scale factor from \fB\-pagewidth\fR is used (non-uniform scaling | |
1003 | is not implemented). | |
1004 | .TP | |
1005 | \fB\-pagewidth \fIsize\fR | |
1006 | Specifies that the Postscript should be scaled in both x and y so | |
1007 | that the printed area is \fIsize\fR wide on the Postscript page. | |
1008 | \fISize\fR has the same form as for \fB\-pageheight\fR. | |
1009 | Defaults to the width of the printed area on the screen. | |
1010 | If both \fB\-pageheight\fR and \fB\-pagewidth\fR are specified then | |
1011 | the scale factor from \fB\-pagewidth\fR is used (non-uniform scaling | |
1012 | is not implemented). | |
1013 | .TP | |
1014 | \fB\-pagex \fIposition\fR | |
1015 | \fIPosition\fR gives the x-coordinate of the positioning point on | |
1016 | the Postscript page, using any of the forms allowed for \fB\-pageheight\fR. | |
1017 | Used in conjunction with the \fB\-pagey\fR and \fB\-pageanchor\fR options | |
1018 | to determine where the printed area appears on the Postscript page. | |
1019 | Defaults to the center of the page. | |
1020 | .TP | |
1021 | \fB\-pagey \fIposition\fR | |
1022 | \fIPosition\fR gives the y-coordinate of the positioning point on | |
1023 | the Postscript page, using any of the forms allowed for \fB\-pageheight\fR. | |
1024 | Used in conjunction with the \fB\-pagex\fR and \fB\-pageanchor\fR options | |
1025 | to determine where the printed area appears on the Postscript page. | |
1026 | Defaults to the center of the page. | |
1027 | .TP | |
1028 | \fB\-rotate \fIboolean\fR | |
1029 | \fIBoolean\fR specifies whether the printed area is to be rotated 90 | |
1030 | degrees. | |
1031 | In non-rotated output the x-axis of the printed area runs along | |
1032 | the short dimension of the page (``portrait'' orientation); | |
1033 | in rotated output the x-axis runs along the long dimension of the | |
1034 | page (``landscape'' orientation). | |
1035 | Defaults to non-rotated. | |
1036 | .TP | |
1037 | \fB\-width \fIsize\fR | |
1038 | Specifies the width of the area of the canvas to print. | |
1039 | Defaults to the width of the canvas window. | |
1040 | .TP | |
1041 | \fB\-x \fIposition\fR | |
1042 | Specifies the x-coordinate of the left edge of the area of the | |
1043 | canvas that is to be printed, in canvas coordinates, not window | |
1044 | coordinates. | |
1045 | Defaults to the coordinate of the left edge of the window. | |
1046 | .TP | |
1047 | \fB\-y \fIposition\fR | |
1048 | Specifies the y-coordinate of the top edge of the area of the | |
1049 | canvas that is to be printed, in canvas coordinates, not window | |
1050 | coordinates. | |
1051 | Defaults to the coordinate of the top edge of the window. | |
1052 | .RE | |
1053 | .TP | |
1054 | \fIpathName \fBraise \fItagOrId \fR?\fIaboveThis\fR? | |
1055 | Move all of the items given by \fItagOrId\fR to a new position | |
1056 | in the display list just after the item given by \fIaboveThis\fR. | |
1057 | If \fItagOrId\fR refers to more than one item then all are moved | |
1058 | but the relative order of the moved items will not be changed. | |
1059 | \fIAboveThis\fR is a tag or id; if it refers to more than one | |
1060 | item then the last (topmost) of these items in the display list is used | |
1061 | as the destination location for the moved items. | |
1062 | Note: this command has no effect on window items. Window items always | |
1063 | obscure other item types, and the stacking order of window items is | |
1064 | determined by the \fBraise\fR and \fBlower\fR commands, not the | |
1065 | \fBraise\fR and \fBlower\fR widget commands for canvases. | |
1066 | This command returns an empty string. | |
1067 | .TP | |
1068 | \fIpathName \fBscale \fItagOrId xOrigin yOrigin xScale yScale\fR | |
1069 | Rescale all of the items given by \fItagOrId\fR in canvas coordinate | |
1070 | space. | |
1071 | \fIXOrigin\fR and \fIyOrigin\fR identify the origin for the scaling | |
1072 | operation and \fIxScale\fR and \fIyScale\fR identify the scale | |
1073 | factors for x- and y-coordinates, respectively (a scale factor of | |
1074 | 1.0 implies no change to that coordinate). | |
1075 | For each of the points defining each item, the x-coordinate is | |
1076 | adjusted to change the distance from \fIxOrigin\fR by a factor | |
1077 | of \fIxScale\fR. | |
1078 | Similarly, each y-coordinate is adjusted to change the distance | |
1079 | from \fIyOrigin\fR by a factor of \fIyScale\fR. | |
1080 | This command returns an empty string. | |
1081 | .TP | |
1082 | \fIpathName \fBscan\fR \fIoption args\fR | |
1083 | This command is used to implement scanning on canvases. It has | |
1084 | two forms, depending on \fIoption\fR: | |
1085 | .RS | |
1086 | .TP | |
1087 | \fIpathName \fBscan mark \fIx y\fR | |
1088 | Records \fIx\fR and \fIy\fR and the canvas's current view; used | |
1089 | in conjunction with later \fBscan dragto\fR commands. | |
1090 | Typically this command is associated with a mouse button press in | |
1091 | the widget and \fIx\fR and \fIy\fR are the coordinates of the | |
1092 | mouse. It returns an empty string. | |
1093 | .TP | |
1094 | \fIpathName \fBscan dragto \fIx y ?gain?\fR. | |
1095 | This command computes the difference between its \fIx\fR and \fIy\fR | |
1096 | arguments (which are typically mouse coordinates) and the \fIx\fR and | |
1097 | \fIy\fR arguments to the last \fBscan mark\fR command for the widget. | |
1098 | It then adjusts the view by \fIgain\fR times the | |
1099 | difference in coordinates, where \fIgain\fR defaults to 10. | |
1100 | This command is typically associated | |
1101 | with mouse motion events in the widget, to produce the effect of | |
1102 | dragging the canvas at high speed through its window. The return | |
1103 | value is an empty string. | |
1104 | .RE | |
1105 | .TP | |
1106 | \fIpathName \fBselect \fIoption\fR ?\fItagOrId arg\fR? | |
1107 | Manipulates the selection in one of several ways, depending on | |
1108 | \fIoption\fR. | |
1109 | The command may take any of the forms described below. | |
1110 | In all of the descriptions below, \fItagOrId\fR must refer to | |
1111 | an item that supports indexing and selection; if it refers to | |
1112 | multiple items then the first of | |
1113 | these that supports indexing and the selection is used. | |
1114 | \fIIndex\fR gives a textual description of a position | |
1115 | within \fItagOrId\fR, as described in INDICES above. | |
1116 | .RS | |
1117 | .TP | |
1118 | \fIpathName \fBselect adjust \fItagOrId index\fR | |
1119 | Locate the end of the selection in \fItagOrId\fR nearest | |
1120 | to the character given by \fIindex\fR, and adjust that | |
1121 | end of the selection to be at \fIindex\fR (i.e. including | |
1122 | but not going beyond \fIindex\fR). | |
1123 | The other end of the selection is made the anchor point | |
1124 | for future \fBselect to\fR commands. | |
1125 | If the selection isn't currently in \fItagOrId\fR then | |
1126 | this command behaves the same as the \fBselect to\fR widget | |
1127 | command. | |
1128 | Returns an empty string. | |
1129 | .TP | |
1130 | \fIpathName \fBselect clear\fR | |
1131 | Clear the selection if it is in this widget. | |
1132 | If the selection isn't in this widget then the command | |
1133 | has no effect. | |
1134 | Returns an empty string. | |
1135 | .TP | |
1136 | \fIpathName \fBselect from \fItagOrId index\fR | |
1137 | Set the selection anchor point for the widget to be just | |
1138 | before the character | |
1139 | given by \fIindex\fR in the item given by \fItagOrId\fR. | |
1140 | This command doesn't change the selection; it just sets | |
1141 | the fixed end of the selection for future \fBselect to\fR | |
1142 | commands. | |
1143 | Returns an empty string. | |
1144 | .TP | |
1145 | \fIpathName \fBselect item\fR | |
1146 | Returns the id of the selected item, if the selection is in an | |
1147 | item in this canvas. | |
1148 | If the selection is not in this canvas then an empty string | |
1149 | is returned. | |
1150 | .TP | |
1151 | \fIpathName \fBselect to \fItagOrId index\fR | |
1152 | Set the selection to consist of those characters of \fItagOrId\fR | |
1153 | between the selection anchor point and | |
1154 | \fIindex\fR. | |
1155 | The new selection will include the character given by \fIindex\fR; | |
1156 | it will include the character given by the anchor point only if | |
1157 | \fIindex\fR is greater than or equal to the anchor point. | |
1158 | The anchor point is determined by the most recent \fBselect adjust\fR | |
1159 | or \fBselect from\fR command for this widget. | |
1160 | If the selection anchor point for the widget isn't currently in | |
1161 | \fItagOrId\fR, then it is set to the same character given | |
1162 | by \fIindex\fR. | |
1163 | Returns an empty string. | |
1164 | .RE | |
1165 | .TP | |
1166 | \fIpathName \fBtype\fI tagOrId\fR | |
1167 | Returns the type of the item given by \fItagOrId\fR, such as | |
1168 | \fBrectangle\fR or \fBtext\fR. | |
1169 | If \fItagOrId\fR refers to more than one item, then the type | |
1170 | of the first item in the display list is returned. | |
1171 | If \fItagOrId\fR doesn't refer to any items at all then | |
1172 | an empty string is returned. | |
1173 | .TP | |
1174 | \fIpathName \fBxview \fR?\fIargs\fR? | |
1175 | This command is used to query and change the horizontal position of the | |
1176 | information displayed in the canvas's window. | |
1177 | It can take any of the following forms: | |
1178 | .RS | |
1179 | .TP | |
1180 | \fIpathName \fBxview\fR | |
1181 | Returns a list containing two elements. | |
1182 | Each element is a real fraction between 0 and 1; together they describe | |
1183 | the horizontal span that is visible in the window. | |
1184 | For example, if the first element is .2 and the second element is .6, | |
1185 | 20% of the canvas's area (as defined by the \fB\-scrollregion\fR option) | |
1186 | is off-screen to the left, the middle 40% is visible | |
1187 | in the window, and 40% of the canvas is off-screen to the right. | |
1188 | These are the same values passed to scrollbars via the \fB\-xscrollcommand\fR | |
1189 | option. | |
1190 | .TP | |
1191 | \fIpathName \fBxview moveto\fI fraction\fR | |
1192 | Adjusts the view in the window so that \fIfraction\fR of the | |
1193 | total width of the canvas is off-screen to the left. | |
1194 | \fIFraction\fR must be a fraction between 0 and 1. | |
1195 | .TP | |
1196 | \fIpathName \fBxview scroll \fInumber what\fR | |
1197 | This command shifts the view in the window left or right according to | |
1198 | \fInumber\fR and \fIwhat\fR. | |
1199 | \fINumber\fR must be an integer. | |
1200 | \fIWhat\fR must be either \fBunits\fR or \fBpages\fR or an abbreviation | |
1201 | of one of these. | |
1202 | If \fIwhat\fR is \fBunits\fR, the view adjusts left or right in units | |
1203 | of the \fBxScrollIncrement\fR option, if it is greater than zero, | |
1204 | or in units of one-tenth the window's width otherwise. | |
1205 | If \fIwhat is \fBpages\fR then the view | |
1206 | adjusts in units of nine-tenths the window's width. | |
1207 | If \fInumber\fR is negative then information farther to the left | |
1208 | becomes visible; if it is positive then information farther to the right | |
1209 | becomes visible. | |
1210 | .RE | |
1211 | .TP | |
1212 | \fIpathName \fByview \fI?args\fR? | |
1213 | This command is used to query and change the vertical position of the | |
1214 | information displayed in the canvas's window. | |
1215 | It can take any of the following forms: | |
1216 | .RS | |
1217 | .TP | |
1218 | \fIpathName \fByview\fR | |
1219 | Returns a list containing two elements. | |
1220 | Each element is a real fraction between 0 and 1; together they describe | |
1221 | the vertical span that is visible in the window. | |
1222 | For example, if the first element is .6 and the second element is 1.0, | |
1223 | the lowest 40% of the canvas's area (as defined by the \fB\-scrollregion\fR | |
1224 | option) is visible in the window. | |
1225 | These are the same values passed to scrollbars via the \fB\-yscrollcommand\fR | |
1226 | option. | |
1227 | .TP | |
1228 | \fIpathName \fByview moveto\fI fraction\fR | |
1229 | Adjusts the view in the window so that \fIfraction\fR of the canvas's | |
1230 | area is off-screen to the top. | |
1231 | \fIFraction\fR is a fraction between 0 and 1. | |
1232 | .TP | |
1233 | \fIpathName \fByview scroll \fInumber what\fR | |
1234 | This command adjusts the view in the window up or down according to | |
1235 | \fInumber\fR and \fIwhat\fR. | |
1236 | \fINumber\fR must be an integer. | |
1237 | \fIWhat\fR must be either \fBunits\fR or \fBpages\fR. | |
1238 | If \fIwhat\fR is \fBunits\fR, the view adjusts up or down in units | |
1239 | of the \fByScrollIncrement\fR option, if it is greater than zero, | |
1240 | or in units of one-tenth the window's height otherwise. | |
1241 | If \fIwhat\fR is \fBpages\fR then | |
1242 | the view adjusts in units of nine-tenths the window's height. | |
1243 | If \fInumber\fR is negative then higher information becomes | |
1244 | visible; if it is positive then lower information | |
1245 | becomes visible. | |
1246 | .RE | |
1247 | .SH "OVERVIEW OF ITEM TYPES" | |
1248 | .PP | |
1249 | The sections below describe the various types of items supported | |
1250 | by canvas widgets. Each item type is characterized by two things: | |
1251 | first, the form of the \fBcreate\fR command used to create | |
1252 | instances of the type; and second, a set of configuration options | |
1253 | for items of that type, which may be used in the | |
1254 | \fBcreate\fR and \fBitemconfigure\fR widget commands. | |
1255 | Most items don't support indexing or selection or the commands | |
1256 | related to them, such as \fBindex\fR and \fBinsert\fR. | |
1257 | Where items do support these facilities, it is noted explicitly | |
1258 | in the descriptions below. | |
1259 | At present, text, line and polygon items provide this support. | |
1260 | For lines and polygons the indexing facility is used to manipulate | |
1261 | the coordinates of the item. | |
1262 | .SH "COMMON ITEM OPTIONS" | |
1263 | .PP | |
1264 | Many items share a common set of options. These options are | |
1265 | explained here, and then referred to be each widget type for brevity. | |
1266 | .PP | |
1267 | .TP | |
1268 | \fB\-dash \fIpattern\fR | |
1269 | .TP | |
1270 | \fB\-activedash \fIpattern\fR | |
1271 | .TP | |
1272 | \fB\-disableddash \fIpattern\fR | |
1273 | This option specifies dash patterns for the normal, active | |
1274 | state, and disabled state of an item. | |
1275 | \fIpattern\fR may have any of the forms accepted by \fBTk_GetDash\fR. | |
1276 | If the dash options are omitted then the default is a solid outline. | |
1277 | See "DASH PATTERNS" for more information. | |
1278 | .TP | |
1279 | \fB\-dashoffset \fIoffset\fR | |
1280 | The starting \fIoffset\fR in pixels into the pattern provided by the | |
1281 | \fB\-dash\fR option. \fB\-dashoffset\fR is ignored if there is no | |
1282 | \fB-dash\fR pattern. The \fIoffset\fR may have any of the forms described | |
1283 | in the \fBCOORDINATES\fR section above. | |
1284 | .TP | |
1285 | \fB\-fill \fIcolor\fR | |
1286 | .TP | |
1287 | \fB\-activefill \fIcolor\fR | |
1288 | .TP | |
1289 | \fB\-disabledfill \fIcolor\fR | |
1290 | Specifies the color to be used to fill item's area. | |
1291 | in its normal, active, and disabled states, | |
1292 | \fIColor\fR may have any of the forms accepted by \fBTk_GetColor\fR. | |
1293 | If \fIcolor\fR is an empty string (the default), | |
1294 | then the item will not be filled. | |
1295 | For the line item, it specifies the color of the line drawn. | |
1296 | For the text item, it specifies the foreground color of the text. | |
1297 | .TP | |
1298 | \fB\-outline \fIcolor\fR | |
1299 | .TP | |
1300 | \fB\-activeoutline \fIcolor\fR | |
1301 | .TP | |
1302 | \fB\-disabledoutline \fIcolor\fR | |
1303 | This option specifies the color that should be used to draw the | |
1304 | outline of the item in its normal, active and disabled states. | |
1305 | \fIColor\fR may have any of the forms accepted by \fBTk_GetColor\fR. | |
1306 | This option defaults to \fBblack\fR. If \fIcolor\fR is specified | |
1307 | as an empty string then no outline is drawn for the item. | |
1308 | .TP | |
1309 | \fB\-offset \fIoffset\fR | |
1310 | Specifies the offset of stipples. The offset value can be of the form | |
1311 | \fBx,y\fR or \fBside\fR, where side can be \fBn\fR, \fBne\fR, \fBe\fR, | |
1312 | \fBse\fR, \fBs\fR, \fBsw\fR, \fBw\fR, \fBnw\fR, or \fBcenter\fR. In the | |
1313 | first case the origin is the origin of the toplevel of the current window. | |
1314 | For the canvas itself and canvas objects the origin is the canvas origin, | |
1315 | but putting \fB#\fR in front of the coordinate pair indicates using the | |
1316 | toplevel origin instead. For canvas objects, the \fB-offset\fR option is | |
1317 | used for stippling as well. For the line and polygon canvas items you can | |
1318 | also specify an index as argument, which connects the stipple origin to one | |
1319 | of the coordinate points of the line/polygon. | |
1320 | .TP | |
1321 | \fB\-outlinestipple \fIbitmap\fR | |
1322 | .TP | |
1323 | \fB\-activeoutlinestipple \fIbitmap\fR | |
1324 | .TP | |
1325 | \fB\-disabledoutlinestipple \fIbitmap\fR | |
1326 | This option specifies stipple patterns that should be used to draw the | |
1327 | outline of the item in its normal, active and disabled states. | |
1328 | Indicates that the outline for the item should be drawn with a stipple pattern; | |
1329 | \fIbitmap\fR specifies the stipple pattern to use, in any of the | |
1330 | forms accepted by \fBTk_GetBitmap\fR. | |
1331 | If the \fB\-outline\fR option hasn't been specified then this option | |
1332 | has no effect. | |
1333 | If \fIbitmap\fR is an empty string (the default), then the outline is drawn | |
1334 | in a solid fashion. | |
1335 | .TP | |
1336 | \fB\-stipple \fIbitmap\fR | |
1337 | .TP | |
1338 | \fB\-activestipple \fIbitmap\fR | |
1339 | .TP | |
1340 | \fB\-disabledstipple \fIbitmap\fR | |
1341 | This option specifies stipple patterns that should be used to fill | |
1342 | the item in its normal, active and disabled states. | |
1343 | \fIbitmap\fR specifies the stipple pattern to use, in any of the | |
1344 | forms accepted by \fBTk_GetBitmap\fR. | |
1345 | If the \fB\-fill\fR option hasn't been specified then this option | |
1346 | has no effect. | |
1347 | If \fIbitmap\fR is an empty string (the default), then filling is done | |
1348 | in a solid fashion. | |
1349 | For the text item, it affects the actual text. | |
1350 | .TP | |
1351 | \fB\-state \fIstate\fR | |
1352 | This allows an item to override the canvas widget's global \fIstate\fR | |
1353 | option. It takes the same values: | |
1354 | \fInormal\fR, \fIdisabled\fR or \fIhidden\fR. | |
1355 | .TP | |
1356 | \fB\-tags \fItagList\fR | |
1357 | Specifies a set of tags to apply to the item. | |
1358 | \fITagList\fR consists of a list of tag names, which replace any | |
1359 | existing tags for the item. \fITagList\fR may be an empty list. | |
1360 | .TP | |
1361 | \fB\-width \fIoutlineWidth\fR | |
1362 | .TP | |
1363 | \fB\-activewidth \fIoutlineWidth\fR | |
1364 | .TP | |
1365 | \fB\-disabledwidth \fIoutlineWidth\fR | |
1366 | Specifies the width of the outline to be drawn around | |
1367 | the item's region, in its normal, active and disabled states. | |
1368 | \fIoutlineWidth\fR may be in any of the forms described in the | |
1369 | \fBCOORDINATES\fR section above. | |
1370 | If the \fB\-outline\fR option has been specified as an empty string then | |
1371 | this option has no effect. This option defaults to 1.0. | |
1372 | For arcs, wide outlines will be drawn centered on the edges of the | |
1373 | arc's region. | |
1374 | .SH "ARC ITEMS" | |
1375 | .PP | |
1376 | Items of type \fBarc\fR appear on the display as arc-shaped regions. | |
1377 | An arc is a section of an oval delimited by two angles (specified | |
1378 | by the \fB\-start\fR and \fB\-extent\fR options) and displayed in | |
1379 | one of several ways (specified by the \fB\-style\fR option). | |
1380 | Arcs are created with widget commands of the following form: | |
1381 | .CS | |
1382 | \fIpathName \fBcreate arc \fIx1 y1 x2 y2 \fR?\fIoption value option value ...\fR? | |
1383 | \fIpathName \fBcreate arc \fIcoordList\fR ?\fIoption value option value ...\fR? | |
1384 | .CE | |
1385 | The arguments \fIx1\fR, \fIy1\fR, \fIx2\fR, and \fIy2\fR or \fIcoordList\fR give | |
1386 | the coordinates of two diagonally opposite corners of a | |
1387 | rectangular region enclosing the oval that defines the arc. | |
1388 | After the coordinates there may be any number of \fIoption\fR\-\fIvalue\fR | |
1389 | pairs, each of which sets one of the configuration options | |
1390 | for the item. These same \fIoption\fR\-\fIvalue\fR pairs may be | |
1391 | used in \fBitemconfigure\fR widget commands to change the item's | |
1392 | configuration. | |
1393 | .br | |
1394 | The following standard options are supported by arcs: | |
1395 | .CS | |
1396 | \-dash | |
1397 | \-activedash | |
1398 | \-disableddash | |
1399 | \-dashoffset | |
1400 | \-fill | |
1401 | \-activefill | |
1402 | \-disabledfill | |
1403 | \-offset | |
1404 | \-outline | |
1405 | \-activeoutline | |
1406 | \-disabledoutline | |
1407 | \-outlinestipple | |
1408 | \-activeoutlinestipple | |
1409 | \-disabledoutlinestipple | |
1410 | \-stipple | |
1411 | \-activestipple | |
1412 | \-disabledstipple | |
1413 | \-state | |
1414 | \-tags | |
1415 | \-width | |
1416 | \-activewidth | |
1417 | \-disabledwidth | |
1418 | .CE | |
1419 | The following extra options are supported for arcs: | |
1420 | .TP | |
1421 | \fB\-extent \fIdegrees\fR | |
1422 | Specifies the size of the angular range occupied by the arc. | |
1423 | The arc's range extends for \fIdegrees\fR degrees counter-clockwise | |
1424 | from the starting angle given by the \fB\-start\fR option. | |
1425 | \fIDegrees\fR may be negative. | |
1426 | If it is greater than 360 or less than -360, then \fIdegrees\fR | |
1427 | modulo 360 is used as the extent. | |
1428 | .TP | |
1429 | \fB\-start \fIdegrees\fR | |
1430 | Specifies the beginning of the angular range occupied by the | |
1431 | arc. | |
1432 | \fIDegrees\fR is given in units of degrees measured counter-clockwise | |
1433 | from the 3-o'clock position; it may be either positive or negative. | |
1434 | .TP | |
1435 | \fB\-style \fItype\fR | |
1436 | Specifies how to draw the arc. If \fItype\fR is \fBpieslice\fR | |
1437 | (the default) then the arc's region is defined by a section | |
1438 | of the oval's perimeter plus two line segments, one between the center | |
1439 | of the oval and each end of the perimeter section. | |
1440 | If \fItype\fR is \fBchord\fR then the arc's region is defined | |
1441 | by a section of the oval's perimeter plus a single line segment | |
1442 | connecting the two end points of the perimeter section. | |
1443 | If \fItype\fR is \fBarc\fR then the arc's region consists of | |
1444 | a section of the perimeter alone. | |
1445 | In this last case the \fB\-fill\fR option is ignored. | |
1446 | .SH "BITMAP ITEMS" | |
1447 | .PP | |
1448 | Items of type \fBbitmap\fR appear on the display as images with | |
1449 | two colors, foreground and background. | |
1450 | Bitmaps are created with widget commands of the following form: | |
1451 | .CS | |
1452 | \fIpathName \fBcreate bitmap \fIx y \fR?\fIoption value option value ...\fR? | |
1453 | \fIpathName \fBcreate bitmap \fIcoordList\fR ?\fIoption value option value ...\fR? | |
1454 | .CE | |
1455 | The arguments \fIx\fR and \fIy\fR or \fIcoordList\fR specify the coordinates of a | |
1456 | point used to position the bitmap on the display (see the \fB\-anchor\fR | |
1457 | option below for more information on how bitmaps are displayed). | |
1458 | After the coordinates there may be any number of \fIoption\fR\-\fIvalue\fR | |
1459 | pairs, each of which sets one of the configuration options | |
1460 | for the item. These same \fIoption\fR\-\fIvalue\fR pairs may be | |
1461 | used in \fBitemconfigure\fR widget commands to change the item's | |
1462 | configuration. | |
1463 | .br | |
1464 | The following standard options are supported by bitmaps: | |
1465 | .CS | |
1466 | \-state | |
1467 | \-tags | |
1468 | .CE | |
1469 | The following extra options are supported for bitmaps: | |
1470 | .TP | |
1471 | \fB\-anchor \fIanchorPos\fR | |
1472 | \fIAnchorPos\fR tells how to position the bitmap relative to the | |
1473 | positioning point for the item; it may have any of the forms | |
1474 | accepted by \fBTk_GetAnchor\fR. For example, if \fIanchorPos\fR | |
1475 | is \fBcenter\fR then the bitmap is centered on the point; if | |
1476 | \fIanchorPos\fR is \fBn\fR then the bitmap will be drawn so that | |
1477 | its top center point is at the positioning point. | |
1478 | This option defaults to \fBcenter\fR. | |
1479 | .TP | |
1480 | \fB\-background \fIcolor\fR | |
1481 | .TP | |
1482 | \fB\-activebackground \fIbitmap\fR | |
1483 | .TP | |
1484 | \fB\-disabledbackground \fIbitmap\fR | |
1485 | Specifies the color to use for each of the bitmap's '0' valued pixels | |
1486 | in its normal, active and disabled states. | |
1487 | \fIColor\fR may have any of the forms accepted by \fBTk_GetColor\fR. | |
1488 | If this option isn't specified, or if it is specified as an empty | |
1489 | string, then nothing is displayed where the bitmap pixels are 0; this | |
1490 | produces a transparent effect. | |
1491 | .TP | |
1492 | \fB\-bitmap \fIbitmap\fR | |
1493 | .TP | |
1494 | \fB\-activebitmap \fIbitmap\fR | |
1495 | .TP | |
1496 | \fB\-disabledbitmap \fIbitmap\fR | |
1497 | Specifies the bitmaps to display in the item in its normal, active and | |
1498 | disabled states. | |
1499 | \fIBitmap\fR may have any of the forms accepted by \fBTk_GetBitmap\fR. | |
1500 | .TP | |
1501 | \fB\-foreground \fIcolor\fR | |
1502 | .TP | |
1503 | \fB\-activeforeground \fIbitmap\fR | |
1504 | .TP | |
1505 | \fB\-disabledforeground \fIbitmap\fR | |
1506 | Specifies the color to use for each of the bitmap's '1' valued pixels | |
1507 | in its normal, active and disabled states. | |
1508 | \fIColor\fR may have any of the forms accepted by \fBTk_GetColor\fR and | |
1509 | defaults to \fBblack\fR. | |
1510 | .SH "IMAGE ITEMS" | |
1511 | .PP | |
1512 | Items of type \fBimage\fR are used to display images on a | |
1513 | canvas. | |
1514 | Images are created with widget commands of the following form: | |
1515 | .CS | |
1516 | \fIpathName \fBcreate image \fIx y \fR?\fIoption value option value ...\fR? | |
1517 | \fIpathName \fBcreate image \fIcoordList\fR ?\fIoption value option value ...\fR? | |
1518 | .CE | |
1519 | The arguments \fIx\fR and \fIy\fR or \fIcoordList\fR specify the coordinates of a | |
1520 | point used to position the image on the display (see the \fB\-anchor\fR | |
1521 | option below for more information). | |
1522 | After the coordinates there may be any number of \fIoption\fR\-\fIvalue\fR | |
1523 | pairs, each of which sets one of the configuration options | |
1524 | for the item. These same \fIoption\fR\-\fIvalue\fR pairs may be | |
1525 | used in \fBitemconfigure\fR widget commands to change the item's | |
1526 | configuration. | |
1527 | .br | |
1528 | The following standard options are supported by images: | |
1529 | .CS | |
1530 | \-state | |
1531 | \-tags | |
1532 | .CE | |
1533 | The following extra options are supported for images: | |
1534 | .TP | |
1535 | \fB\-anchor \fIanchorPos\fR | |
1536 | \fIAnchorPos\fR tells how to position the image relative to the | |
1537 | positioning point for the item; it may have any of the forms | |
1538 | accepted by \fBTk_GetAnchor\fR. For example, if \fIanchorPos\fR | |
1539 | is \fBcenter\fR then the image is centered on the point; if | |
1540 | \fIanchorPos\fR is \fBn\fR then the image will be drawn so that | |
1541 | its top center point is at the positioning point. | |
1542 | This option defaults to \fBcenter\fR. | |
1543 | .TP | |
1544 | \fB\-image \fIname\fR | |
1545 | .TP | |
1546 | \fB\-activeimage \fIname\fR | |
1547 | .TP | |
1548 | \fB\-disabledimage \fIname\fR | |
1549 | Specifies the name of the images to display in the item in is normal, | |
1550 | active and disabled states. | |
1551 | This image must have been created previously with the | |
1552 | \fBimage create\fR command. | |
1553 | .SH "LINE ITEMS" | |
1554 | .PP | |
1555 | Items of type \fBline\fR appear on the display as one or more connected | |
1556 | line segments or curves. | |
1557 | Line items support coordinate indexing operations using the canvas | |
1558 | widget commands: \fBdchars, index, insert.\fR | |
1559 | Lines are created with widget commands of the following form: | |
1560 | .CS | |
1561 | \fIpathName \fBcreate line \fIx1 y1... xn yn \fR?\fIoption value option value ...\fR? | |
1562 | \fIpathName \fBcreate line \fIcoordList\fR ?\fIoption value option value ...\fR? | |
1563 | .CE | |
1564 | The arguments \fIx1\fR through \fIyn\fR or \fIcoordList\fR give | |
1565 | the coordinates for a series of two or more points that describe | |
1566 | a series of connected line segments. | |
1567 | After the coordinates there may be any number of \fIoption\fR\-\fIvalue\fR | |
1568 | pairs, each of which sets one of the configuration options | |
1569 | for the item. These same \fIoption\fR\-\fIvalue\fR pairs may be | |
1570 | used in \fBitemconfigure\fR widget commands to change the item's | |
1571 | configuration. | |
1572 | .br | |
1573 | The following standard options are supported by lines: | |
1574 | .CS | |
1575 | \-dash | |
1576 | \-activedash | |
1577 | \-disableddash | |
1578 | \-dashoffset | |
1579 | \-fill | |
1580 | \-activefill | |
1581 | \-disabledfill | |
1582 | \-stipple | |
1583 | \-activestipple | |
1584 | \-disabledstipple | |
1585 | \-state | |
1586 | \-tags | |
1587 | \-width | |
1588 | \-activewidth | |
1589 | \-disabledwidth | |
1590 | .CE | |
1591 | The following extra options are supported for lines: | |
1592 | .TP | |
1593 | \fB\-arrow \fIwhere\fR | |
1594 | Indicates whether or not arrowheads are to be drawn at one or both | |
1595 | ends of the line. | |
1596 | \fIWhere\fR must have one of the values \fBnone\fR (for no arrowheads), | |
1597 | \fBfirst\fR (for an arrowhead at the first point of the line), | |
1598 | \fBlast\fR (for an arrowhead at the last point of the line), or | |
1599 | \fBboth\fR (for arrowheads at both ends). | |
1600 | This option defaults to \fBnone\fR. | |
1601 | .TP | |
1602 | \fB\-arrowshape \fIshape\fR | |
1603 | This option indicates how to draw arrowheads. | |
1604 | The \fIshape\fR argument must be a list with three elements, each | |
1605 | specifying a distance in any of the forms described in | |
1606 | the \fBCOORDINATES\fR section above. | |
1607 | The first element of the list gives the distance along the line | |
1608 | from the neck of the arrowhead to its tip. | |
1609 | The second element gives the distance along the line from the | |
1610 | trailing points of the arrowhead to the tip, and the third | |
1611 | element gives the distance from the outside edge of the line to the | |
1612 | trailing points. | |
1613 | If this option isn't specified then Tk picks a ``reasonable'' shape. | |
1614 | .TP | |
1615 | \fB\-capstyle \fIstyle\fR | |
1616 | Specifies the ways in which caps are to be drawn at the endpoints | |
1617 | of the line. | |
1618 | \fIStyle\fR may have any of the forms accepted by \fBTk_GetCapStyle\fR | |
1619 | (\fBbutt\fR, \fBprojecting\fR, or \fBround\fR). | |
1620 | If this option isn't specified then it defaults to \fBbutt\fR. | |
1621 | Where arrowheads are drawn the cap style is ignored. | |
1622 | .TP | |
1623 | \fB\-joinstyle \fIstyle\fR | |
1624 | Specifies the ways in which joints are to be drawn at the vertices | |
1625 | of the line. | |
1626 | \fIStyle\fR may have any of the forms accepted by \fBTk_GetCapStyle\fR | |
1627 | (\fBbevel\fR, \fBmiter\fR, or \fBround\fR). | |
1628 | If this option isn't specified then it defaults to \fBmiter\fR. | |
1629 | If the line only contains two points then this option is | |
1630 | irrelevant. | |
1631 | .TP | |
1632 | \fB\-smooth \fIsmoothMethod\fR | |
1633 | \fIsmoothMethod\fR must have one of the forms accepted by | |
1634 | \fBTcl_GetBoolean\fR or a line smoothing method. Only \fBbezier\fR is | |
1635 | supported in the core, but more can be added at runtime. If a boolean | |
1636 | false value or empty string is given, no smoothing is applied. A boolean | |
1637 | truth value assume \fBbezier\fR smoothing. | |
1638 | It indicates whether or not the line should be drawn as a curve. | |
1639 | If so, the line is rendered as a set of parabolic splines: one spline | |
1640 | is drawn for the first and second line segments, one for the second | |
1641 | and third, and so on. Straight-line segments can be generated within | |
1642 | a curve by duplicating the end-points of the desired line segment. | |
1643 | .TP | |
1644 | \fB\-splinesteps \fInumber\fR | |
1645 | Specifies the degree of smoothness desired for curves: each spline | |
1646 | will be approximated with \fInumber\fR line segments. This | |
1647 | option is ignored unless the \fB\-smooth\fR option is true. | |
1648 | ||
1649 | .SH "OVAL ITEMS" | |
1650 | .PP | |
1651 | Items of type \fBoval\fR appear as circular or oval regions on | |
1652 | the display. Each oval may have an outline, a fill, or | |
1653 | both. Ovals are created with widget commands of the | |
1654 | following form: | |
1655 | .CS | |
1656 | \fIpathName \fBcreate oval \fIx1 y1 x2 y2 \fR?\fIoption value option value ...\fR? | |
1657 | \fIpathName \fBcreate oval \fIcoordList\fR ?\fIoption value option value ...\fR? | |
1658 | .CE | |
1659 | The arguments \fIx1\fR, \fIy1\fR, \fIx2\fR, and \fIy2\fR or \fIcoordList\fR give | |
1660 | the coordinates of two diagonally opposite corners of a | |
1661 | rectangular region enclosing the oval. | |
1662 | The oval will include the top and left edges of the rectangle | |
1663 | not the lower or right edges. | |
1664 | If the region is square then the resulting oval is circular; | |
1665 | otherwise it is elongated in shape. | |
1666 | After the coordinates there may be any number of \fIoption\fR\-\fIvalue\fR | |
1667 | pairs, each of which sets one of the configuration options | |
1668 | for the item. These same \fIoption\fR\-\fIvalue\fR pairs may be | |
1669 | used in \fBitemconfigure\fR widget commands to change the item's | |
1670 | configuration. | |
1671 | .br | |
1672 | The following standard options are supported by ovals: | |
1673 | .CS | |
1674 | \-dash | |
1675 | \-activedash | |
1676 | \-disableddash | |
1677 | \-dashoffset | |
1678 | \-fill | |
1679 | \-activefill | |
1680 | \-disabledfill | |
1681 | \-offset | |
1682 | \-outline | |
1683 | \-activeoutline | |
1684 | \-disabledoutline | |
1685 | \-outlinestipple | |
1686 | \-activeoutlinestipple | |
1687 | \-disabledoutlinestipple | |
1688 | \-stipple | |
1689 | \-activestipple | |
1690 | \-disabledstipple | |
1691 | \-state | |
1692 | \-tags | |
1693 | \-width | |
1694 | \-activewidth | |
1695 | \-disabledwidth | |
1696 | .CE | |
1697 | .SH "POLYGON ITEMS" | |
1698 | .PP | |
1699 | Items of type \fBpolygon\fR appear as polygonal or curved filled regions | |
1700 | on the display. | |
1701 | Polygon items support coordinate indexing operations using the canvas | |
1702 | widget commands: \fBdchars, index, insert.\fR | |
1703 | Polygons are created with widget commands of the following form: | |
1704 | .CS | |
1705 | \fIpathName \fBcreate polygon \fIx1 y1 ... xn yn \fR?\fIoption value option value ...\fR? | |
1706 | \fIpathName \fBcreate polygon \fIcoordList\fR ?\fIoption value option value ...\fR? | |
1707 | .CE | |
1708 | The arguments \fIx1\fR through \fIyn\fR or \fIcoordList\fR specify the coordinates for | |
1709 | three or more points that define a polygon. | |
1710 | The first point should not be repeated as the last to | |
1711 | close the shape; Tk will automatically close the periphery between | |
1712 | the first and last points. | |
1713 | After the coordinates there may be any number of \fIoption\fR\-\fIvalue\fR | |
1714 | pairs, each of which sets one of the configuration options | |
1715 | for the item. These same \fIoption\fR\-\fIvalue\fR pairs may be | |
1716 | used in \fBitemconfigure\fR widget commands to change the item's | |
1717 | configuration. | |
1718 | .br | |
1719 | The following standard options are supported by polygons: | |
1720 | .CS | |
1721 | \-dash | |
1722 | \-activedash | |
1723 | \-disableddash | |
1724 | \-dashoffset | |
1725 | \-fill | |
1726 | \-activefill | |
1727 | \-disabledfill | |
1728 | \-offset | |
1729 | \-outline | |
1730 | \-activeoutline | |
1731 | \-disabledoutline | |
1732 | \-outlinestipple | |
1733 | \-activeoutlinestipple | |
1734 | \-disabledoutlinestipple | |
1735 | \-stipple | |
1736 | \-activestipple | |
1737 | \-disabledstipple | |
1738 | \-state | |
1739 | \-tags | |
1740 | \-width | |
1741 | \-activewidth | |
1742 | \-disabledwidth | |
1743 | .CE | |
1744 | The following extra options are supported for polygons: | |
1745 | .TP | |
1746 | \fB\-joinstyle \fIstyle\fR | |
1747 | Specifies the ways in which joints are to be drawn at the vertices | |
1748 | of the outline. | |
1749 | \fIStyle\fR may have any of the forms accepted by \fBTk_GetCapStyle\fR | |
1750 | (\fBbevel\fR, \fBmiter\fR, or \fBround\fR). | |
1751 | If this option isn't specified then it defaults to \fBmiter\fR. | |
1752 | .TP | |
1753 | \fB\-smooth \fIboolean\fR | |
1754 | \fIBoolean\fR must have one of the forms accepted by \fBTcl_GetBoolean\fR. | |
1755 | It indicates whether or not the polygon should be drawn with a | |
1756 | curved perimeter. | |
1757 | If so, the outline of the polygon becomes a set of parabolic splines, | |
1758 | one spline for the first and second line segments, one for the second | |
1759 | and third, and so on. Straight-line segments can be generated in a | |
1760 | smoothed polygon by duplicating the end-points of the desired line segment. | |
1761 | .TP | |
1762 | \fB\-splinesteps \fInumber\fR | |
1763 | Specifies the degree of smoothness desired for curves: each spline | |
1764 | will be approximated with \fInumber\fR line segments. This | |
1765 | option is ignored unless the \fB\-smooth\fR option is true. | |
1766 | .PP | |
1767 | Polygon items are different from other items such as rectangles, ovals | |
1768 | and arcs in that interior points are considered to be ``inside'' a | |
1769 | polygon (e.g. for purposes of the \fBfind closest\fR and | |
1770 | \fBfind overlapping\fR widget commands) even if it is not filled. | |
1771 | For most other item types, an | |
1772 | interior point is considered to be inside the item only if the item | |
1773 | is filled or if it has neither a fill nor an outline. If you would | |
1774 | like an unfilled polygon whose interior points are not considered | |
1775 | to be inside the polygon, use a line item instead. | |
1776 | .SH "RECTANGLE ITEMS" | |
1777 | .PP | |
1778 | Items of type \fBrectangle\fR appear as rectangular regions on | |
1779 | the display. Each rectangle may have an outline, a fill, or | |
1780 | both. Rectangles are created with widget commands of the | |
1781 | following form: | |
1782 | .CS | |
1783 | \fIpathName \fBcreate rectangle \fIx1 y1 x2 y2 \fR?\fIoption value option value ...\fR? | |
1784 | \fIpathName \fBcreate rectangle \fIcoordList\fR ?\fIoption value option value ...\fR? | |
1785 | .CE | |
1786 | The arguments \fIx1\fR, \fIy1\fR, \fIx2\fR, and \fIy2\fR or \fIcoordList\fR give | |
1787 | the coordinates of two diagonally opposite corners of the rectangle | |
1788 | (the rectangle will include its upper and left edges but not | |
1789 | its lower or right edges). | |
1790 | After the coordinates there may be any number of \fIoption\fR\-\fIvalue\fR | |
1791 | pairs, each of which sets one of the configuration options | |
1792 | for the item. These same \fIoption\fR\-\fIvalue\fR pairs may be | |
1793 | used in \fBitemconfigure\fR widget commands to change the item's | |
1794 | configuration. | |
1795 | .br | |
1796 | The following standard options are supported by rectangles: | |
1797 | .CS | |
1798 | \-dash | |
1799 | \-activedash | |
1800 | \-disableddash | |
1801 | \-dashoffset | |
1802 | \-fill | |
1803 | \-activefill | |
1804 | \-disabledfill | |
1805 | \-offset | |
1806 | \-outline | |
1807 | \-activeoutline | |
1808 | \-disabledoutline | |
1809 | \-outlinestipple | |
1810 | \-activeoutlinestipple | |
1811 | \-disabledoutlinestipple | |
1812 | \-stipple | |
1813 | \-activestipple | |
1814 | \-disabledstipple | |
1815 | \-state | |
1816 | \-tags | |
1817 | \-width | |
1818 | \-activewidth | |
1819 | \-disabledwidth | |
1820 | .CE | |
1821 | .SH "TEXT ITEMS" | |
1822 | .PP | |
1823 | A text item displays a string of characters on the screen in one | |
1824 | or more lines. | |
1825 | Text items support indexing and selection, along with the | |
1826 | following text-related canvas widget commands: \fBdchars\fR, | |
1827 | \fBfocus\fR, \fBicursor\fR, \fBindex\fR, \fBinsert\fR, | |
1828 | \fBselect\fR. | |
1829 | Text items are created with widget commands of the following | |
1830 | form: | |
1831 | .CS | |
1832 | \fIpathName \fBcreate text \fIx y \fR?\fIoption value option value ...\fR? | |
1833 | \fIpathName \fBcreate text \fIcoordList\fR ?\fIoption value option value ...\fR? | |
1834 | .CE | |
1835 | The arguments \fIx\fR and \fIy\fR or \fIcoordList\fR specify the coordinates of a | |
1836 | point used to position the text on the display (see the options | |
1837 | below for more information on how text is displayed). | |
1838 | After the coordinates there may be any number of \fIoption\fR\-\fIvalue\fR | |
1839 | pairs, each of which sets one of the configuration options | |
1840 | for the item. These same \fIoption\fR\-\fIvalue\fR pairs may be | |
1841 | used in \fBitemconfigure\fR widget commands to change the item's | |
1842 | configuration. | |
1843 | .br | |
1844 | The following standard options are supported by text items: | |
1845 | .CS | |
1846 | \-fill | |
1847 | \-activefill | |
1848 | \-disabledfill | |
1849 | \-stipple | |
1850 | \-activestipple | |
1851 | \-disabledstipple | |
1852 | \-state | |
1853 | \-tags | |
1854 | .CE | |
1855 | The following extra options are supported for text items: | |
1856 | .TP | |
1857 | \fB\-anchor \fIanchorPos\fR | |
1858 | \fIAnchorPos\fR tells how to position the text relative to the | |
1859 | positioning point for the text; it may have any of the forms | |
1860 | accepted by \fBTk_GetAnchor\fR. For example, if \fIanchorPos\fR | |
1861 | is \fBcenter\fR then the text is centered on the point; if | |
1862 | \fIanchorPos\fR is \fBn\fR then the text will be drawn such that | |
1863 | the top center point of the rectangular region occupied by the | |
1864 | text will be at the positioning point. | |
1865 | This option defaults to \fBcenter\fR. | |
1866 | .TP | |
1867 | \fB\-font \fIfontName\fR | |
1868 | Specifies the font to use for the text item. | |
1869 | \fIFontName\fR may be any string acceptable to \fBTk_GetFont\fR. | |
1870 | If this option isn't specified, it defaults to a system-dependent | |
1871 | font. | |
1872 | .TP | |
1873 | \fB\-justify \fIhow\fR | |
1874 | Specifies how to justify the text within its bounding region. | |
1875 | \fIHow\fR must be one of the values \fBleft\fR, \fBright\fR, | |
1876 | or \fBcenter\fR. | |
1877 | This option will only matter if the text is displayed as multiple | |
1878 | lines. | |
1879 | If the option is omitted, it defaults to \fBleft\fR. | |
1880 | .TP | |
1881 | \fB\-text \fIstring\fR | |
1882 | \fIString\fR specifies the characters to be displayed in the text item. | |
1883 | Newline characters cause line breaks. | |
1884 | The characters in the item may also be changed with the | |
1885 | \fBinsert\fR and \fBdelete\fR widget commands. | |
1886 | This option defaults to an empty string. | |
1887 | .TP | |
1888 | \fB\-width \fIlineLength\fR | |
1889 | Specifies a maximum line length for the text, in any of the forms | |
1890 | described in the \fBCOORDINATES\fR section above. | |
1891 | If this option is zero (the default) the text is broken into | |
1892 | lines only at newline characters. | |
1893 | However, if this option is non-zero then any line that would | |
1894 | be longer than \fIlineLength\fR is broken just before a space | |
1895 | character to make the line shorter than \fIlineLength\fR; the | |
1896 | space character is treated as if it were a newline | |
1897 | character. | |
1898 | .SH "WINDOW ITEMS" | |
1899 | .PP | |
1900 | Items of type \fBwindow\fR cause a particular window to be displayed | |
1901 | at a given position on the canvas. | |
1902 | Window items are created with widget commands of the following form: | |
1903 | .CS | |
1904 | \fIpathName \fBcreate window \fIx y \fR?\fIoption value option value ...\fR? | |
1905 | \fIpathName \fBcreate window \fIcoordList\fR ?\fIoption value option value ...\fR? | |
1906 | .CE | |
1907 | The arguments \fIx\fR and \fIy\fR or \fIcoordList\fR specify the coordinates of a | |
1908 | point used to position the window on the display (see the \fB\-anchor\fR | |
1909 | option below for more information on how bitmaps are displayed). | |
1910 | After the coordinates there may be any number of \fIoption\fR\-\fIvalue\fR | |
1911 | pairs, each of which sets one of the configuration options | |
1912 | for the item. These same \fIoption\fR\-\fIvalue\fR pairs may be | |
1913 | used in \fBitemconfigure\fR widget commands to change the item's | |
1914 | configuration. | |
1915 | .br | |
1916 | The following standard options are supported by window items: | |
1917 | .CS | |
1918 | \-state | |
1919 | \-tags | |
1920 | .CE | |
1921 | The following extra options are supported for window items: | |
1922 | .TP | |
1923 | \fB\-anchor \fIanchorPos\fR | |
1924 | \fIAnchorPos\fR tells how to position the window relative to the | |
1925 | positioning point for the item; it may have any of the forms | |
1926 | accepted by \fBTk_GetAnchor\fR. For example, if \fIanchorPos\fR | |
1927 | is \fBcenter\fR then the window is centered on the point; if | |
1928 | \fIanchorPos\fR is \fBn\fR then the window will be drawn so that | |
1929 | its top center point is at the positioning point. | |
1930 | This option defaults to \fBcenter\fR. | |
1931 | .TP | |
1932 | \fB\-height \fIpixels\fR | |
1933 | Specifies the height to assign to the item's window. | |
1934 | \fIPixels\fR may have any of the | |
1935 | forms described in the \fBCOORDINATES\fR section above. | |
1936 | If this option isn't specified, or if it is specified as an empty | |
1937 | string, then the window is given whatever height it requests internally. | |
1938 | .TP | |
1939 | \fB\-width \fIpixels\fR | |
1940 | Specifies the width to assign to the item's window. | |
1941 | \fIPixels\fR may have any of the | |
1942 | forms described in the \fBCOORDINATES\fR section above. | |
1943 | If this option isn't specified, or if it is specified as an empty | |
1944 | string, then the window is given whatever width it requests internally. | |
1945 | .TP | |
1946 | \fB\-window \fIpathName\fR | |
1947 | Specifies the window to associate with this item. | |
1948 | The window specified by \fIpathName\fR must either be a child of | |
1949 | the canvas widget or a child of some ancestor of the canvas widget. | |
1950 | \fIPathName\fR may not refer to a top-level window. | |
1951 | .PP | |
1952 | Note: due to restrictions in the ways that windows are managed, it is not | |
1953 | possible to draw other graphical items (such as lines and images) on top | |
1954 | of window items. A window item always obscures any graphics that | |
1955 | overlap it, regardless of their order in the display list. | |
1956 | .SH "APPLICATION-DEFINED ITEM TYPES" | |
1957 | .PP | |
1958 | It is possible for individual applications to define new item | |
1959 | types for canvas widgets using C code. | |
1960 | See the documentation for \fBTk_CreateItemType\fR. | |
1961 | .SH BINDINGS | |
1962 | .PP | |
1963 | In the current implementation, new canvases are not given any | |
1964 | default behavior: you'll have to execute explicit Tcl commands | |
1965 | to give the canvas its behavior. | |
1966 | .SH CREDITS | |
1967 | .PP | |
1968 | Tk's canvas widget is a blatant ripoff of ideas from Joel Bartlett's | |
1969 | \fIezd\fR program. \fIEzd\fR provides structured graphics in a Scheme | |
1970 | environment and preceded canvases by a year or two. Its simple | |
1971 | mechanisms for placing and animating graphical objects inspired the | |
1972 | functions of canvases. | |
1973 | ||
1974 | .SH "SEE ALSO" | |
1975 | bind(n), font(n), image(n), scrollbar(n) | |
1976 | ||
1977 | .SH KEYWORDS | |
1978 | canvas, widget |