Debian Codegraph @

info/gcl-tk/canvas.html

raw
1 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
2 <html>
3 <!-- Created by GNU Texinfo 6.7, http://www.gnu.org/software/texinfo/ -->
4 <head>
5 <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
6 <title>canvas (GCL TK Manual)</title>
7
8 <meta name="description" content="canvas (GCL TK Manual)">
9 <meta name="keywords" content="canvas (GCL TK Manual)">
10 <meta name="resource-type" content="document">
11 <meta name="distribution" content="global">
12 <meta name="Generator" content="makeinfo">
13 <link href="index.html" rel="start" title="Top">
14 <link href="wm.html#SEC_Contents" rel="contents" title="Table of Contents">
15 <link href="Widgets.html" rel="up" title="Widgets">
16 <link href="menu.html" rel="next" title="menu">
17 <link href="scale.html" rel="prev" title="scale">
18 <style type="text/css">
19 <!--
20 a.summary-letter {text-decoration: none}
21 blockquote.indentedblock {margin-right: 0em}
22 div.display {margin-left: 3.2em}
23 div.example {margin-left: 3.2em}
24 div.lisp {margin-left: 3.2em}
25 kbd {font-style: oblique}
26 pre.display {font-family: inherit}
27 pre.format {font-family: inherit}
28 pre.menu-comment {font-family: serif}
29 pre.menu-preformatted {font-family: serif}
30 span.nolinebreak {white-space: nowrap}
31 span.roman {font-family: initial; font-weight: normal}
32 span.sansserif {font-family: sans-serif; font-weight: normal}
33 ul.no-bullet {list-style: none}
34 -->
35 </style>
36
37
38 </head>
39
40 <body lang="en">
41 <span id="canvas"></span><div class="header">
42 <p>
43 Next: <a href="menu.html" accesskey="n" rel="next">menu</a>, Previous: <a href="scale.html" accesskey="p" rel="prev">scale</a>, Up: <a href="Widgets.html" accesskey="u" rel="up">Widgets</a> &nbsp; [<a href="wm.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>]</p>
44 </div>
45 <hr>
46 <span id="canvas-1"></span><h3 class="section">2.4 canvas</h3>
47
48 <p>canvas \- Create and manipulate canvas widgets
49 </p><span id="Synopsis-3"></span><h4 class="unnumberedsubsec">Synopsis</h4>
50 <p><b>canvas</b><i> </i><i>pathName </i><span class="roman">?</span><i>options</i>?
51 </p><span id="Standard-Options-3"></span><h4 class="unnumberedsubsec">Standard Options</h4>
52
53
54 <div class="example">
55 <pre class="example">background insertBorderWidth relief xScrollCommand
56 borderWidth insertOffTime selectBackground yScrollCommand
57 cursor insertOnTime selectBorderWidth
58 insertBackground insertWidth selectForeground
59 </pre></div>
60
61
62 <p>See <a href="options.html">options</a>, for more information.
63 </p><span id="Arguments-for-Canvas"></span><h4 class="unnumberedsubsec">Arguments for Canvas</h4>
64
65
66 <dl compact="compact">
67 <dt><code><b>:closeenough</b></code></dt>
68 <dd><p align="right">Name=<code>&quot;<b>closeEnough</b><span class="roman">&quot;</span> Class=<code>&quot;</code><b>CloseEnough</b>&quot;</code>
69 </p><br>
70
71 <p>Specifies a floating-point value indicating how close the mouse cursor
72 must be to an item before it is considered to be &ldquo;inside&rdquo; the item.
73 Defaults to 1.0.
74 </p></dd>
75 </dl>
76
77
78 <dl compact="compact">
79 <dt><code><b>:confine</b></code></dt>
80 <dd><p align="right">Name=<code>&quot;<b>confine</b><span class="roman">&quot;</span> Class=<code>&quot;</code><b>Confine</b>&quot;</code>
81 </p><br>
82
83 <p>Specifies a boolean value that indicates whether or not it should be
84 allowable to set the canvas&rsquo;s view outside the region defined by the
85 <b>scrollRegion</b> argument.
86 Defaults to true, which means that the view will
87 be constrained within the scroll region.
88 </p></dd>
89 </dl>
90
91
92 <dl compact="compact">
93 <dt><code><b>:height</b></code></dt>
94 <dd><p align="right">Name=<code>&quot;<b>height</b><span class="roman">&quot;</span> Class=<code>&quot;</code><b>Height</b>&quot;</code>
95 </p><br>
96
97 <p>Specifies a desired window height that the canvas widget should request from
98 its geometry manager. The value may be specified in any
99 of the forms described in the COORDINATES section below.
100 </p></dd>
101 </dl>
102
103
104 <dl compact="compact">
105 <dt><code><b>:scrollincrement</b></code></dt>
106 <dd><p align="right">Name=<code>&quot;<b>scrollIncrement</b><span class="roman">&quot;</span> Class=<code>&quot;</code><b>ScrollIncrement</b>&quot;</code>
107 </p><br>
108
109 <p>Specifies a distance used as increment during scrolling: when one of
110 the arrow buttons on an associated scrollbar is pressed, the picture
111 will shift by this distance. The distance may be specified in any
112 of the forms described in the COORDINATES section below.
113 </p></dd>
114 </dl>
115
116
117 <dl compact="compact">
118 <dt><code><b>:scrollregion</b></code></dt>
119 <dd><p align="right">Name=<code>&quot;<b>scrollRegion</b><span class="roman">&quot;</span> Class=<code>&quot;</code><b>ScrollRegion</b>&quot;</code>
120 </p><br>
121
122 <p>Specifies a list with four coordinates describing the left, top, right, and
123 bottom coordinates of a rectangular region.
124 This region is used for scrolling purposes and is considered to be
125 the boundary of the information in the canvas.
126 Each of the coordinates may be specified
127 in any of the forms given in the COORDINATES section below.
128 </p></dd>
129 </dl>
130
131
132 <dl compact="compact">
133 <dt><code><b>:width</b></code></dt>
134 <dd><p align="right">Name=<code>&quot;<b>width</b><span class="roman">&quot;</span> Class=<code>&quot;</code><b>width</b>&quot;</code>
135 </p><br>
136
137 <p>Specifies a desired window width that the canvas widget should request from
138 its geometry manager. The value may be specified in any
139 of the forms described in the COORDINATES section below.
140 </p></dd>
141 </dl>
142
143 <span id="Introduction-2"></span><h4 class="unnumberedsubsec">Introduction</h4>
144
145 <p>The <b>canvas</b> command creates a new window (given
146 by the <i>pathName</i> argument) and makes it into a canvas widget.
147 Additional options, described above, may be specified on the
148 command line or in the option database
149 to configure aspects of the canvas such as its colors and 3-D relief.
150 The <b>canvas</b> command returns its
151 <i>pathName</i> argument. At the time this command is invoked,
152 there must not exist a window named <i>pathName</i>, but
153 <i>pathName</i>&rsquo;s parent must exist.
154 </p>
155 <p>Canvas widgets implement structured graphics.
156 A canvas displays any number of <i>items</i>, which may be things like
157 rectangles, circles, lines, and text.
158 Items may be manipulated (e.g. moved or re-colored) and commands may
159 be associated with items in much the same way that the <b>bind</b>
160 command allows commands to be bound to widgets. For example,
161 a particular command may be associated with the &lt;Button-1&gt; event
162 so that the command is invoked whenever button 1 is pressed with
163 the mouse cursor over an item.
164 This means that items in a canvas can have behaviors defined by
165 the Tcl scripts bound to them.
166 </p>
167 <span id="Display-List"></span><h4 class="unnumberedsubsec">Display List</h4>
168
169 <p>The items in a canvas are ordered for purposes of display,
170 with the first item in the display list being displayed
171 first, followed by the next item in the list, and so on.
172 Items later in the display list obscure those that are
173 earlier in the display list and are sometimes referred to
174 as being &ldquo;on top&rdquo; of earlier items.
175 When a new item is created it is placed at the end of the
176 display list, on top of everything else.
177 Widget commands may be used to re-arrange the order of the
178 display list.
179 </p>
180 <span id="Item-Ids-And-Tags"></span><h4 class="unnumberedsubsec">Item Ids And Tags</h4>
181
182 <p>Items in a canvas widget may be named in either of two ways:
183 by id or by tag.
184 Each item has a unique identifying number which is assigned to
185 that item when it is created. The id of an item never changes
186 and id numbers are never re-used within the lifetime of a
187 canvas widget.
188 </p>
189 <p>Each item may also have any number of <i>tags</i> associated
190 with it. A tag is just a string of characters, and it may
191 take any form except that of an integer.
192 For example, &ldquo;x123&rdquo; is OK but &ldquo;123&rdquo; isn&rsquo;t.
193 The same tag may be associated with many different items.
194 This is commonly done to group items in various interesting
195 ways; for example, all selected items might be given the
196 tag &ldquo;selected&rdquo;.
197 </p>
198 <p>The tag <b>all</b> is implicitly associated with every item
199 in the canvas; it may be used to invoke operations on
200 all the items in the canvas.
201 </p>
202 <p>The tag <b>current</b> is managed automatically by Tk;
203 it applies to the <i>current item</i>, which is the
204 topmost item whose drawn area covers the position of
205 the mouse cursor.
206 If the mouse is not in the canvas widget or is not over
207 an item, then no item has the <b>current</b> tag.
208 </p>
209 <p>When specifying items in canvas widget commands, if the
210 specifier is an integer then it is assumed to refer to
211 the single item with that id.
212 If the specifier is not an integer, then it is assumed to
213 refer to all of the items in the canvas that have a tag
214 matching the specifier.
215 The symbol <i>tagOrId</i> is used below to indicate that
216 an argument specifies either an id that selects a single
217 item or a tag that selects zero or more items.
218 Some widget commands only operate on a single item at a
219 time; if <i>tagOrId</i> is specified in a way that
220 names multiple items, then the normal behavior is for
221 the command to use the first (lowest) of these items in
222 the display list that is suitable for the command.
223 Exceptions are noted in the widget command descriptions
224 below.
225 </p>
226 <span id="Coordinates"></span><h4 class="unnumberedsubsec">Coordinates</h4>
227
228 <p>All coordinates related to canvases are stored as floating-point
229 numbers.
230 Coordinates and distances are specified in screen units,
231 which are floating-point numbers optionally followed
232 by one of several letters.
233 If no letter is supplied then the distance is in pixels.
234 If the letter is <b>m</b> then the distance is in millimeters on
235 the screen; if it is <b>c</b> then the distance is in centimeters;
236 <b>i</b><span class="roman"> means inches, and </span><b>p</b> means printers points (1/72 inch).
237 Larger y-coordinates refer to points lower on the screen; larger
238 x-coordinates refer to points farther to the right.
239 </p>
240 <span id="Transformations"></span><h4 class="unnumberedsubsec">Transformations</h4>
241
242 <p>Normally the origin of the canvas coordinate system is at the
243 upper-left corner of the window containing the canvas.
244 It is possible to adjust the origin of the canvas
245 coordinate system relative to the origin of the window using the
246 <b>xview</b><span class="roman"> and </span><b>yview</b> widget commands; this is typically used
247 for scrolling.
248 Canvases do not support scaling or rotation of the canvas coordinate
249 system relative to the window coordinate system.
250 </p>
251 <p>Indidividual items may be moved or scaled using widget commands
252 described below, but they may not be rotated.
253 </p>
254 <span id="Indices"></span><h4 class="unnumberedsubsec">Indices</h4>
255
256 <p>Text items support the notion of an <i>index</i> for identifying
257 particular positions within the item.
258 Indices are used for commands such as inserting text, deleting
259 a range of characters, and setting the insertion cursor position.
260 An index may be specified in any of a number of ways, and
261 different types of items may support different forms for
262 specifying indices.
263 Text items support the following forms for an index; if you
264 define new types of text-like items, it would be advisable to
265 support as many of these forms as practical.
266 Note that it is possible to refer to the character just after
267 the last one in the text item; this is necessary for such
268 tasks as inserting new text at the end of the item.
269 </p>
270 <dl compact="compact">
271 <dt><i>number</i></dt>
272 <dd><p>A decimal number giving the position of the desired character
273 within the text item.
274 0 refers to the first character, 1 to the next character, and
275 so on.
276 A number less than 0 is treated as if it were zero, and a
277 number greater than the length of the text item is treated
278 as if it were equal to the length of the text item.
279 </p></dd>
280 <dt><b>end</b></dt>
281 <dd><p>Refers to the character just after the last one in the item
282 (same as the number of characters in the item).
283 </p></dd>
284 <dt><b>insert</b></dt>
285 <dd><p>Refers to the character just before which the insertion cursor
286 is drawn in this item.
287 </p></dd>
288 <dt><b>sel.first</b></dt>
289 <dd><p>Refers to the first selected character in the item.
290 If the selection isn&rsquo;t in this item then this form is illegal.
291 </p></dd>
292 <dt><b>sel.last</b></dt>
293 <dd><p>Refers to the last selected character in the item.
294 If the selection isn&rsquo;t in this item then this form is illegal.
295 </p></dd>
296 <dt><b>@</b><i>x,y</i></dt>
297 <dd><p>Refers to the character at the point given by <i>x</i> and
298 <i>y</i><span class="roman">, where </span><i>x</i><span class="roman"> and </span><i>y</i> are specified in the coordinate
299 system of the canvas.
300 If <i>x</i><span class="roman"> and </span><i>y</i> lie outside the coordinates covered by the
301 text item, then they refer to the first or last character in the
302 line that is closest to the given point.
303 </p>
304 </dd>
305 </dl>
306 <span id="A-Canvas-Widget_0027s-Arguments"></span><h4 class="unnumberedsubsec">A Canvas Widget&rsquo;s Arguments</h4>
307
308 <p>The <b>canvas</b> command creates a new Tcl command whose
309 name is <i>pathName</i>. This
310 command may be used to invoke various
311 operations on the widget. It has the following general form:
312 </p>
313 <div class="example">
314 <pre class="example"><i>pathName option </i><span class="roman">?</span><i>arg arg ...</i>?
315 </pre></div>
316
317 <p><i>Option</i><span class="roman"> and the </span><i>arg</i>s
318 determine the exact behavior of the command.
319 The following widget commands are possible for canvas widgets:
320 </p>
321 <dl compact="compact">
322 <dt><i>pathName </i><b>:addtag </b><i>tag searchSpec </i><span class="roman">?</span><i>arg arg ...</i>?</dt>
323 <dd><p>For each item that meets the constraints specified by
324 <i>searchSpec</i><span class="roman"> and the </span><i>arg</i>s, add
325 <i>tag</i> to the list of tags associated with the item if it
326 isn&rsquo;t already present on that list.
327 It is possible that no items will satisfy the constraints
328 given by <i>searchSpec and </i><i>arg</i>s, in which case the
329 command has no effect.
330 This command returns an empty string as result.
331 <i>SearchSpec</i><span class="roman"> and </span><i>arg</i>&rsquo;s may take any of the following
332 forms:
333 </p>
334 <dl compact="compact">
335 <dt><b>above </b><i>tagOrId</i></dt>
336 <dd><p>Selects the item just after (above) the one given by <i>tagOrId</i>
337 in the display list.
338 If <i>tagOrId</i> denotes more than one item, then the last (topmost)
339 of these items in the display list is used.
340 </p></dd>
341 <dt><b>all</b></dt>
342 <dd><p>Selects all the items in the canvas.
343 </p></dd>
344 <dt><b>below </b><i>tagOrId</i></dt>
345 <dd><p>Selects the item just before (below) the one given by <i>tagOrId</i>
346 in the display list.
347 If <i>tagOrId</i> denotes more than one item, then the first (lowest)
348 of these items in the display list is used.
349 </p></dd>
350 <dt><b>closest </b><i>x y </i><span class="roman">?</span><i>halo</i><span class="roman">? ?</span><i>start</i>?</dt>
351 <dd><p>Selects the item closest to the point given by <i>x</i><span class="roman"> and </span><i>y</i>.
352 If more than one item is at the same closest distance (e.g. two
353 items overlap the point), then the top-most of these items (the
354 last one in the display list) is used.
355 If <i>halo</i> is specified, then it must be a non-negative
356 value.
357 Any item closer than <i>halo</i> to the point is considered to
358 overlap it.
359 The <i>start</i> argument may be used to step circularly through
360 all the closest items.
361 If <i>start</i> is specified, it names an item using a tag or id
362 (if by tag, it selects the first item in the display list with
363 the given tag).
364 Instead of selecting the topmost closest item, this form will
365 select the topmost closest item that is below <i>start</i> in
366 the display list; if no such item exists, then the selection
367 behaves as if the <i>start</i> argument had not been specified.
368 </p></dd>
369 <dt><b>enclosed</b><span class="roman"> </span><i>x1</i><span class="roman"> </span><i>y1</i><span class="roman"> </span><i>x2</i><span class="roman"> </span><i>y2</i></dt>
370 <dd><p>Selects all the items completely enclosed within the rectangular
371 region given by <i>x1</i><span class="roman">, </span><i>y1</i><span class="roman">, </span><i>x2</i><span class="roman">, and </span><i>y2</i>.
372 <i>X1</i><span class="roman"> must be no greater then </span><i>x2</i><span class="roman"> and </span><i>y1</i> must be
373 no greater than <i>y2</i>.
374 </p></dd>
375 <dt><b>overlapping</b><span class="roman"> </span><i>x1</i><span class="roman"> </span><i>y1</i><span class="roman"> </span><i>x2</i><span class="roman"> </span><i>y2</i></dt>
376 <dd><p>Selects all the items that overlap or are enclosed within the
377 rectangular region given by <i>x1</i><span class="roman">, </span><i>y1</i><span class="roman">, </span><i>x2</i>,
378 and <i>y2</i>.
379 <i>X1</i><span class="roman"> must be no greater then </span><i>x2</i><span class="roman"> and </span><i>y1</i> must be
380 no greater than <i>y2</i>.
381 </p></dd>
382 <dt><b>withtag </b><i>tagOrId</i></dt>
383 <dd><p>Selects all the items given by <i>tagOrId</i>.
384 </p></dd>
385 </dl>
386
387 </dd>
388 <dt><i>pathName </i><b>:bbox </b><i>tagOrId</i><span class="roman"> ?</span><i>tagOrId tagOrId ...</i>?</dt>
389 <dd><p>Returns a list with four elements giving an approximate bounding box
390 for all the items named by the <i>tagOrId</i> arguments.
391 The list has the form &ldquo;<i>x1 y1 x2 y2</i>&rdquo; such that the drawn
392 areas of all the named elements are within the region bounded by
393 <i>x1</i><span class="roman"> on the left, </span><i>x2</i><span class="roman"> on the right, </span><i>y1</i> on the top,
394 and <i>y2</i> on the bottom.
395 The return value may overestimate the actual bounding box by
396 a few pixels.
397 If no items match any of the <i>tagOrId</i> arguments then an
398 empty string is returned.
399 </p></dd>
400 <dt><i>pathName </i><b>:bind </b><i>tagOrId</i><span class="roman"> ?</span><i>sequence</i><span class="roman">? ?</span><i>command</i>?</dt>
401 <dd><p>This command associates <i>command</i> with all the items given by
402 <i>tagOrId</i> such that whenever the event sequence given by
403 <i>sequence</i> occurs for one of the items the command will
404 be invoked.
405 This widget command is similar to the <b>bind</b> command except that
406 it operates on items in a canvas rather than entire widgets.
407 See the <b>bind</b> manual entry for complete details
408 on the syntax of <i>sequence</i> and the substitutions performed
409 on <i>command</i> before invoking it.
410 If all arguments are specified then a new binding is created, replacing
411 any existing binding for the same <i>sequence</i><span class="roman"> and </span><i>tagOrId</i>
412 (if the first character of <i>command</i><span class="roman"> is &ldquo;+&rdquo; then </span><i>command</i>
413 augments an existing binding rather than replacing it).
414 In this case the return value is an empty string.
415 If <i>command</i><span class="roman"> is omitted then the command returns the </span><i>command</i>
416 associated with <i>tagOrId</i><span class="roman"> and </span><i>sequence</i> (an error occurs
417 if there is no such binding).
418 If both <i>command</i><span class="roman"> and </span><i>sequence</i> are omitted then the command
419 returns a list of all the sequences for which bindings have been
420 defined for <i>tagOrId</i>.
421 </p></dd>
422 </dl>
423
424
425 <p>The only events for which bindings may be specified are those related
426 to the mouse and keyboard, such as <b>Enter</b><span class="roman">, </span><b>Leave</b>,
427 <b>ButtonPress</b><span class="roman">, </span><b>Motion</b><span class="roman">, and </span><b>KeyPress</b>.
428 The handling of events in canvases uses the current item defined
429 in ITEM IDS AND TAGS above.
430 <b>Enter</b><span class="roman"> and </span><b>Leave</b> events trigger for an item when it
431 becomes the current item or ceases to be the current item; note
432 that these events are different than <b>Enter</b><span class="roman"> and </span><b>Leave</b>
433 events for windows.
434 Mouse-related events are directed to the current item, if any.
435 Keyboard-related events are directed to the focus item, if any
436 (see the <b>focus</b> widget command below for more on this).
437 </p>
438
439 <p>It is possible for multiple commands to be bound to a single
440 event sequence for a single object.
441 This occurs, for example, if one command is associated with the
442 item&rsquo;s id and another is associated with one of the item&rsquo;s tags.
443 When this occurs, the first matching binding is used.
444 A binding for the item&rsquo;s id has highest priority, followed by
445 the oldest tag for the item and proceeding through all of the
446 item&rsquo;s tags up through the most-recently-added one.
447 If a binding is associated with the tag <b>all</b>, the binding
448 will have lower priority than all other bindings associated
449 with the item.
450 </p>
451 <dl compact="compact">
452 <dt><i>pathName </i><b>:canvasx </b><i>screenx</i><span class="roman"> ?</span><i>gridspacing</i>?</dt>
453 <dd><p>Given a screen x-coordinate <i>screenx</i> this command returns
454 the canvas x-coordinate that is displayed at that location.
455 If <i>gridspacing</i> is specified, then the canvas coordinate is
456 rounded to the nearest multiple of <i>gridspacing</i> units.
457 </p></dd>
458 <dt><i>pathName </i><b>:canvasy </b><i>screeny</i><span class="roman"> ?</span><i>gridspacing</i>?</dt>
459 <dd><p>Given a screen y-coordinate <i>screeny</i> this command returns
460 the canvas y-coordinate that is displayed at that location.
461 If <i>gridspacing</i> is specified, then the canvas coordinate is
462 rounded to the nearest multiple of <i>gridspacing</i> units.
463 </p></dd>
464 <dt><i>pathName </i><b>:configure ?</b><i>option</i><span class="roman">? ?</span><i>value</i><span class="roman">? ?</span><i>option value ...</i>?</dt>
465 <dd><p>Query or modify the configuration options of the widget.
466 If no <i>option</i> is specified, returns a list describing all of
467 the available options for <i>pathName</i><span class="roman"> (see </span><b>Tk_ConfigureInfo</b> for
468 information on the format of this list). If <i>option</i> is specified
469 with no <i>value</i>, then the command returns a list describing the
470 one named option (this list will be identical to the corresponding
471 sublist of the value returned if no <i>option</i> is specified). If
472 one or more <i>option:value</i> pairs are specified, then the command
473 modifies the given widget option(s) to have the given value(s); in
474 this case the command returns an empty string.
475 <i>Option</i><span class="roman"> may have any of the values accepted by the </span><b>canvas</b>
476 command.
477 </p></dd>
478 <dt><i>pathName</i><span class="roman"> </span><b>:coords </b><i>tagOrId </i><span class="roman">?</span><i>x0 y0 ...</i>?</dt>
479 <dd><p>Query or modify the coordinates that define an item.
480 If no coordinates are specified, this command returns a list
481 whose elements are the coordinates of the item named by
482 <i>tagOrId</i>.
483 If coordinates are specified, then they replace the current
484 coordinates for the named item.
485 If <i>tagOrId</i> refers to multiple items, then
486 the first one in the display list is used.
487 </p></dd>
488 <dt><i>pathName </i><b>:create </b><i>type x y </i><span class="roman">?</span><i>x y ...</i><span class="roman">? ?</span><i>option value ...</i>?</dt>
489 <dd><p>Create a new item in <i>pathName</i><span class="roman"> of type </span><i>type</i>.
490 The exact format of the arguments after <b>type</b> depends
491 on <b>type</b>, but usually they consist of the coordinates for
492 one or more points, followed by specifications for zero or
493 more item options.
494 See the subsections on individual item types below for more
495 on the syntax of this command.
496 This command returns the id for the new item.
497 </p></dd>
498 <dt><i>pathName </i><b>:dchars </b><i>tagOrId first </i><span class="roman">?</span><i>last</i>?</dt>
499 <dd><p>For each item given by <i>tagOrId</i>, delete the characters
500 in the range given by <i>first</i><span class="roman"> and </span><i>last</i>,
501 inclusive.
502 If some of the items given by <i>tagOrId</i> don&rsquo;t support
503 text operations, then they are ignored.
504 <i>First</i><span class="roman"> and </span><i>last</i> are indices of characters
505 within the item(s) as described in INDICES above.
506 If <i>last</i><span class="roman"> is omitted, it defaults to </span><i>first</i>.
507 This command returns an empty string.
508 </p></dd>
509 <dt><i>pathName </i><b>:delete </b><span class="roman">?</span><i>tagOrId tagOrId ...</i>?</dt>
510 <dd><p>Delete each of the items given by each <i>tagOrId</i>, and return
511 an empty string.
512 </p></dd>
513 <dt><i>pathName </i><b>:dtag </b><i>tagOrId </i><span class="roman">?tagToDelete</span>?</dt>
514 <dd><p>For each of the items given by <i>tagOrId</i>, delete the
515 tag given by <i>tagToDelete</i> from the list of those
516 associated with the item.
517 If an item doesn&rsquo;t have the tag <i>tagToDelete</i> then
518 the item is unaffected by the command.
519 If <i>tagToDelete</i><span class="roman"> is omitted then it defaults to </span><i>tagOrId</i>.
520 This command returns an empty string.
521 </p></dd>
522 <dt><i>pathName </i><b>:find </b><i>searchCommand </i><span class="roman">?</span><i>arg arg ...</i>?</dt>
523 <dd><p>This command returns a list consisting of all the items that
524 meet the constraints specified by <i>searchCommand</i> and
525 <i>arg</i>&rsquo;s.
526 <i>SearchCommand</i><span class="roman"> and </span><i>args</i> have any of the forms
527 accepted by the <b>addtag</b> command.
528 </p></dd>
529 <dt><i>pathName </i><b>:focus </b><span class="roman">?</span><i>tagOrId</i>?</dt>
530 <dd><p>Set the keyboard focus for the canvas widget to the item given by
531 <i>tagOrId</i>.
532 If <i>tagOrId</i> refers to several items, then the focus is set
533 to the first such item in the display list that supports the
534 insertion cursor.
535 If <i>tagOrId</i> doesn&rsquo;t refer to any items, or if none of them
536 support the insertion cursor, then the focus isn&rsquo;t changed.
537 If <i>tagOrId</i> is an empty
538 string, then the focus item is reset so that no item has the focus.
539 If <i>tagOrId</i> is not specified then the command returns the
540 id for the item that currently has the focus, or an empty string
541 if no item has the focus.
542 </p></dd>
543 </dl>
544
545
546 <p>Once the focus has been set to an item, the item will display
547 the insertion cursor and all keyboard events will be directed
548 to that item.
549 The focus item within a canvas and the focus window on the
550 screen (set with the <b>focus</b> command) are totally independent:
551 a given item doesn&rsquo;t actually have the input focus unless (a)
552 its canvas is the focus window and (b) the item is the focus item
553 within the canvas.
554 In most cases it is advisable to follow the <b>focus</b> widget
555 command with the <b>focus</b> command to set the focus window to
556 the canvas (if it wasn&rsquo;t there already).
557 </p>
558 <dl compact="compact">
559 <dt><i>pathName </i><b>:gettags</b><span class="roman"> </span><i>tagOrId</i></dt>
560 <dd><p>Return a list whose elements are the tags associated with the
561 item given by <i>tagOrId</i>.
562 If <i>tagOrId</i> refers to more than one item, then the tags
563 are returned from the first such item in the display list.
564 If <i>tagOrId</i> doesn&rsquo;t refer to any items, or if the item
565 contains no tags, then an empty string is returned.
566 </p></dd>
567 <dt><i>pathName </i><b>:icursor </b><i>tagOrId index</i></dt>
568 <dd><p>Set the position of the insertion cursor for the item(s)
569 given by <i>tagOrId</i>
570 to just before the character whose position is given by <i>index</i>.
571 If some or all of the items given by <i>tagOrId</i> don&rsquo;t support
572 an insertion cursor then this command has no effect on them.
573 See INDICES above for a description of the
574 legal forms for <i>index</i>.
575 Note: the insertion cursor is only displayed in an item if
576 that item currently has the keyboard focus (see the widget
577 command <b>focus</b>, below), but the cursor position may
578 be set even when the item doesn&rsquo;t have the focus.
579 This command returns an empty string.
580 </p></dd>
581 <dt><i>pathName </i><b>:index </b><i>tagOrId index</i></dt>
582 <dd><p>This command returns a decimal string giving the numerical index
583 within <i>tagOrId</i><span class="roman"> corresponding to </span><i>index</i>.
584 <i>Index</i> gives a textual description of the desired position
585 as described in INDICES above.
586 The return value is guaranteed to lie between 0 and the number
587 of characters within the item, inclusive.
588 If <i>tagOrId</i> refers to multiple items, then the index
589 is processed in the first of these items that supports indexing
590 operations (in display list order).
591 </p></dd>
592 <dt><i>pathName </i><b>:insert </b><i>tagOrId beforeThis string</i></dt>
593 <dd><p>For each of the items given by <i>tagOrId</i>, if the item supports
594 text insertion then <i>string</i> is inserted into the item&rsquo;s
595 text just before the character whose index is <i>beforeThis</i>.
596 See INDICES above for information about the forms allowed
597 for <i>beforeThis</i>.
598 This command returns an empty string.
599 </p></dd>
600 <dt><i>pathName </i><b>:itemconfigure </b><i>tagOrId</i><span class="roman"> ?</span><i>option</i><span class="roman">? ?</span><i>value</i><span class="roman">? ?</span><i>option value ...</i>?</dt>
601 <dd><p>This command is similar to the <b>configure</b> widget command except
602 that it modifies item-specific options for the items given by
603 <i>tagOrId</i> instead of modifying options for the overall
604 canvas widget.
605 If no <i>option</i> is specified, returns a list describing all of
606 the available options for the first item given by <i>tagOrId</i>
607 (see <b>Tk_ConfigureInfo</b> for
608 information on the format of this list). If <i>option</i> is specified
609 with no <i>value</i>, then the command returns a list describing the
610 one named option (this list will be identical to the corresponding
611 sublist of the value returned if no <i>option</i> is specified). If
612 one or more <i>option:value</i> pairs are specified, then the command
613 modifies the given widget option(s) to have the given value(s) in
614 each of the items given by <i>tagOrId</i>; in
615 this case the command returns an empty string.
616 The <i>option</i><span class="roman">s and </span><i>value</i>s are the same as those permissible
617 in the <b>create</b> widget command when the item(s) were created;
618 see the sections describing individual item types below for details
619 on the legal options.
620 </p></dd>
621 <dt><i>pathName </i><b>:lower </b><i>tagOrId </i><span class="roman">?</span><i>belowThis</i>?</dt>
622 <dd><p>Move all of the items given by <i>tagOrId</i> to a new position
623 in the display list just before the item given by <i>belowThis</i>.
624 If <i>tagOrId</i> refers to more than one item then all are moved
625 but the relative order of the moved items will not be changed.
626 <i>BelowThis</i> is a tag or id; if it refers to more than one
627 item then the first (lowest) of these items in the display list is used
628 as the destination location for the moved items.
629 This command returns an empty string.
630 </p></dd>
631 <dt><i>pathName </i><b>:move </b><i>tagOrId xAmount yAmount</i></dt>
632 <dd><p>Move each of the items given by <i>tagOrId</i> in the canvas coordinate
633 space by adding <i>xAmount</i> to the x-coordinate of each point
634 associated with the item and <i>yAmount</i> to the y-coordinate of
635 each point associated with the item.
636 This command returns an empty string.
637 </p></dd>
638 <dt><i>pathName </i><b>:postscript </b><span class="roman">?</span><i>option value option value ...</i>?</dt>
639 <dd><p>Generate a Postscript representation for part or all of the canvas.
640 If the <b>:file</b> option is specified then the Postscript is written
641 to a file and an empty string is returned; otherwise the Postscript
642 is returned as the result of the command.
643 The Postscript is created in Encapsulated Postscript form using
644 version 3.0 of the Document Structuring Conventions.
645 The <i>option</i>\-<i>value</i> argument pairs provide additional
646 information to control the generation of Postscript. The following
647 options are supported:
648 </p>
649 <dl compact="compact">
650 <dt><b>:colormap </b><i>varName</i></dt>
651 <dd><p><i>VarName</i> must be the name of a global array variable
652 that specifies a color mapping to use in the Postscript.
653 Each element of <i>varName</i> must consist of Postscript
654 code to set a particular color value (e.g. &ldquo;<b>1.0 1.0 0.0 setrgbcolor</b>&rdquo;).
655 When outputting color information in the Postscript, Tk checks
656 to see if there is an element of <i>varName</i> with the same
657 name as the color.
658 If so, Tk uses the value of the element as the Postscript command
659 to set the color.
660 If this option hasn&rsquo;t been specified, or if there isn&rsquo;t an entry
661 in <i>varName</i> for a given color, then Tk uses the red, green,
662 and blue intensities from the X color.
663 </p></dd>
664 <dt><b>:colormode </b><i>mode</i></dt>
665 <dd><p>Specifies how to output color information. <i>Mode</i> must be either
666 <b>color</b><span class="roman"> (for full color output), </span><b>gray</b> (convert all colors
667 to their gray-scale equivalents) or <b>mono</b> (convert all colors
668 to black or white).
669 </p></dd>
670 <dt><b>:file </b><i>fileName</i></dt>
671 <dd><p>Specifies the name of the file in which to write the Postscript.
672 If this option isn&rsquo;t specified then the Postscript is returned as the
673 result of the command instead of being written to a file.
674 </p></dd>
675 <dt><b>:fontmap </b><i>varName</i></dt>
676 <dd><p><i>VarName</i> must be the name of a global array variable
677 that specifies a font mapping to use in the Postscript.
678 Each element of <i>varName</i> must consist of a Tcl list with
679 two elements, which are the name and point size of a Postscript font.
680 When outputting Postscript commands for a particular font, Tk
681 checks to see if <i>varName</i> contains an element with the same
682 name as the font.
683 If there is such an element, then the font information contained in
684 that element is used in the Postscript.
685 Otherwise Tk attempts to guess what Postscript font to use.
686 Tk&rsquo;s guesses generally only work for well-known fonts such as
687 Times and Helvetica and Courier, and only if the X font name does not
688 omit any dashes up through the point size.
689 For example, \fB\-*\-Courier\-Bold\-R\-Normal\-\-*\-120\-* will work but
690 \fB*Courier\-Bold\-R\-Normal*120* will not; Tk needs the dashes to
691 parse the font name).
692 </p></dd>
693 <dt><b>:height </b><i>size</i></dt>
694 <dd><p>Specifies the height of the area of the canvas to print.
695 Defaults to the height of the canvas window.
696 </p></dd>
697 <dt><b>:pageanchor </b><i>anchor</i></dt>
698 <dd><p>Specifies which point of the printed area should be appear over
699 the positioning point on the page (which is given by the <b>:pagex</b>
700 and <b>:pagey</b> options).
701 For example, <b>:pageanchor n</b> means that the top center of the
702 printed area should be over the positioning point.
703 Defaults to <b>center</b>.
704 </p></dd>
705 <dt><b>:pageheight </b><i>size</i></dt>
706 <dd><p>Specifies that the Postscript should be scaled in both x and y so
707 that the printed area is <i>size</i> high on the Postscript page.
708 <i>Size</i> consists of a floating-point number followed by
709 <b>c</b><span class="roman"> for centimeters, </span><b>i</b><span class="roman"> for inches, </span><b>m</b> for millimeters,
710 or <b>p</b> or nothing for printer&rsquo;s points (1/72 inch).
711 Defaults to the height of the printed area on the screen.
712 If both <b>:pageheight</b><span class="roman"> and </span><b>:pagewidth</b> are specified then
713 the scale factor from the later option is used (non-uniform scaling
714 is not implemented).
715 </p></dd>
716 <dt><b>:pagewidth </b><i>size</i></dt>
717 <dd><p>Specifies that the Postscript should be scaled in both x and y so
718 that the printed area is <i>size</i> wide on the Postscript page.
719 <i>Size</i><span class="roman"> has the same form as for </span><b>:pageheight</b>.
720 Defaults to the width of the printed area on the screen.
721 If both <b>:pageheight</b><span class="roman"> and </span><b>:pagewidth</b> are specified then
722 the scale factor from the later option is used (non-uniform scaling
723 is not implemented).
724 </p></dd>
725 <dt><b>:pagex </b><i>position</i></dt>
726 <dd><p><i>Position</i> gives the x-coordinate of the positioning point on
727 the Postscript page, using any of the forms allowed for <b>:pageheight</b>.
728 Used in conjunction with the <b>:pagey</b><span class="roman"> and </span><b>:pageanchor</b> options
729 to determine where the printed area appears on the Postscript page.
730 Defaults to the center of the page.
731 </p></dd>
732 <dt><b>:pagey </b><i>position</i></dt>
733 <dd><p><i>Position</i> gives the y-coordinate of the positioning point on
734 the Postscript page, using any of the forms allowed for <b>:pageheight</b>.
735 Used in conjunction with the <b>:pagex</b><span class="roman"> and </span><b>:pageanchor</b> options
736 to determine where the printed area appears on the Postscript page.
737 Defaults to the center of the page.
738 </p></dd>
739 <dt><b>:rotate </b><i>boolean</i></dt>
740 <dd><p><i>Boolean</i> specifies whether the printed area is to be rotated 90
741 degrees.
742 In non-rotated output the x-axis of the printed area runs along
743 the short dimension of the page (&ldquo;portrait&rdquo; orientation);
744 in rotated output the x-axis runs along the long dimension of the
745 page (&ldquo;landscape&rdquo; orientation).
746 Defaults to non-rotated.
747 </p></dd>
748 <dt><b>:width </b><i>size</i></dt>
749 <dd><p>Specifies the width of the area of the canvas to print.
750 Defaults to the width of the canvas window.
751 </p></dd>
752 <dt><b>:x </b><i>position</i></dt>
753 <dd><p>Specifies the x-coordinate of the left edge of the area of the
754 canvas that is to be printed, in canvas coordinates, not window
755 coordinates.
756 Defaults to the coordinate of the left edge of the window.
757 </p></dd>
758 <dt><b>:y </b><i>position</i></dt>
759 <dd><p>Specifies the y-coordinate of the top edge of the area of the
760 canvas that is to be printed, in canvas coordinates, not window
761 coordinates.
762 Defaults to the coordinate of the top edge of the window.
763 </p></dd>
764 </dl>
765
766 </dd>
767 <dt><i>pathName </i><b>:raise </b><i>tagOrId </i><span class="roman">?</span><i>aboveThis</i>?</dt>
768 <dd><p>Move all of the items given by <i>tagOrId</i> to a new position
769 in the display list just after the item given by <i>aboveThis</i>.
770 If <i>tagOrId</i> refers to more than one item then all are moved
771 but the relative order of the moved items will not be changed.
772 <i>AboveThis</i> is a tag or id; if it refers to more than one
773 item then the last (topmost) of these items in the display list is used
774 as the destination location for the moved items.
775 This command returns an empty string.
776 </p></dd>
777 <dt><i>pathName </i><b>:scale </b><i>tagOrId xOrigin yOrigin xScale yScale</i></dt>
778 <dd><p>Rescale all of the items given by <i>tagOrId</i> in canvas coordinate
779 space.
780 <i>XOrigin</i><span class="roman"> and </span><i>yOrigin</i> identify the origin for the scaling
781 operation and <i>xScale</i><span class="roman"> and </span><i>yScale</i> identify the scale
782 factors for x- and y-coordinates, respectively (a scale factor of
783 1.0 implies no change to that coordinate).
784 For each of the points defining each item, the x-coordinate is
785 adjusted to change the distance from <i>xOrigin</i> by a factor
786 of <i>xScale</i>.
787 Similarly, each y-coordinate is adjusted to change the distance
788 from <i>yOrigin</i><span class="roman"> by a factor of </span><i>yScale</i>.
789 This command returns an empty string.
790 </p></dd>
791 <dt><i>pathName </i><b>:scan</b><span class="roman"> </span><i>option args</i></dt>
792 <dd><p>This command is used to implement scanning on canvases. It has
793 two forms, depending on <i>option</i>:
794 </p>
795 <dl compact="compact">
796 <dt><i>pathName </i><b>:scan :mark </b><i>x y</i></dt>
797 <dd><p>Records <i>x</i><span class="roman"> and </span><i>y</i> and the canvas&rsquo;s current view; used
798 in conjunction with later <b>scan dragto</b> commands.
799 Typically this command is associated with a mouse button press in
800 the widget and <i>x</i><span class="roman"> and </span><i>y</i> are the coordinates of the
801 mouse. It returns an empty string.
802 </p></dd>
803 <dt><i>pathName </i><b>:scan :dragto </b><i>x y</i>.</dt>
804 <dd><p>This command computes the difference between its <i>x</i><span class="roman"> and </span><i>y</i>
805 arguments (which are typically mouse coordinates) and the <i>x</i> and
806 <i>y</i><span class="roman"> arguments to the last </span><b>scan mark</b> command for the widget.
807 It then adjusts the view by 10 times the
808 difference in coordinates. This command is typically associated
809 with mouse motion events in the widget, to produce the effect of
810 dragging the canvas at high speed through its window. The return
811 value is an empty string.
812 </p></dd>
813 </dl>
814
815 </dd>
816 <dt><i>pathName </i><b>:select </b><i>option</i><span class="roman"> ?</span><i>tagOrId arg</i>?</dt>
817 <dd><p>Manipulates the selection in one of several ways, depending on
818 <i>option</i>.
819 The command may take any of the forms described below.
820 In all of the descriptions below, <i>tagOrId</i> must refer to
821 an item that supports indexing and selection; if it refers to
822 multiple items then the first of
823 these that supports indexing and the selection is used.
824 <i>Index</i> gives a textual description of a position
825 within <i>tagOrId</i>, as described in INDICES above.
826 </p>
827 <dl compact="compact">
828 <dt><i>pathName </i><b>:select :adjust </b><i>tagOrId index</i></dt>
829 <dd><p>Locate the end of the selection in <i>tagOrId</i> nearest
830 to the character given by <i>index</i>, and adjust that
831 end of the selection to be at <i>index</i> (i.e. including
832 but not going beyond <i>index</i>).
833 The other end of the selection is made the anchor point
834 for future <b>select to</b> commands.
835 If the selection isn&rsquo;t currently in <i>tagOrId</i> then
836 this command behaves the same as the <b>select to</b> widget
837 command.
838 Returns an empty string.
839 </p></dd>
840 <dt><i>pathName </i><b>:select :clear</b></dt>
841 <dd><p>Clear the selection if it is in this widget.
842 If the selection isn&rsquo;t in this widget then the command
843 has no effect.
844 Returns an empty string.
845 </p></dd>
846 <dt><i>pathName </i><b>:select :from </b><i>tagOrId index</i></dt>
847 <dd><p>Set the selection anchor point for the widget to be just
848 before the character
849 given by <i>index</i><span class="roman"> in the item given by </span><i>tagOrId</i>.
850 This command doesn&rsquo;t change the selection; it just sets
851 the fixed end of the selection for future <b>select to</b>
852 commands.
853 Returns an empty string.
854 </p></dd>
855 <dt><i>pathName </i><b>:select :item</b></dt>
856 <dd><p>Returns the id of the selected item, if the selection is in an
857 item in this canvas.
858 If the selection is not in this canvas then an empty string
859 is returned.
860 </p></dd>
861 <dt><i>pathName </i><b>:select :to </b><i>tagOrId index</i></dt>
862 <dd><p>Set the selection to consist of those characters of <i>tagOrId</i>
863 between the selection anchor point and
864 <i>index</i>.
865 The new selection will include the character given by <i>index</i>;
866 it will include the character given by the anchor point only if
867 <i>index</i> is greater than or equal to the anchor point.
868 The anchor point is determined by the most recent <b>select adjust</b>
869 or <b>select from</b> command for this widget.
870 If the selection anchor point for the widget isn&rsquo;t currently in
871 <i>tagOrId</i>, then it is set to the same character given
872 by <i>index</i>.
873 Returns an empty string.
874 </p></dd>
875 </dl>
876
877 </dd>
878 <dt><i>pathName </i><b>:type</b><i> tagOrId</i></dt>
879 <dd><p>Returns the type of the item given by <i>tagOrId</i>, such as
880 <b>rectangle</b><span class="roman"> or </span><b>text</b>.
881 If <i>tagOrId</i> refers to more than one item, then the type
882 of the first item in the display list is returned.
883 If <i>tagOrId</i> doesn&rsquo;t refer to any items at all then
884 an empty string is returned.
885 </p></dd>
886 <dt><i>pathName </i><b>:xview</b><i> index</i></dt>
887 <dd><p>Change the view in the canvas so that the canvas position given by
888 <i>index</i> appears at the left edge of the window.
889 This command is typically used by scrollbars to scroll the
890 canvas.
891 <i>Index</i> counts in units of scroll increments (the value of the
892 <b>scrollIncrement</b> option): a value of 0 corresponds to the left
893 edge of the scroll region (as defined by the <b>scrollRegion</b>
894 option), a value of 1 means one scroll unit to the right of this,
895 and so on. The return value is an empty string.
896 </p></dd>
897 <dt><i>pathName </i><b>:yview</b><i> index</i></dt>
898 <dd><p>Change the view in the canvas so that the canvas position given by
899 <i>index</i> appears at the top edge of the window.
900 This command is typically used by scrollbars to scroll the
901 canvas.
902 <i>Index</i> counts in units of scroll increments (the value of the
903 <b>scrollIncrement</b> option): a value of 0 corresponds to the top
904 edge of the scroll region (as defined by the <b>scrollRegion</b>
905 option), a value of 1 means one scroll unit below this,
906 and so on. The return value is an empty string.
907 </p>
908 </dd>
909 </dl>
910 <span id="Overview-Of-Item-Types"></span><h4 class="unnumberedsubsec">Overview Of Item Types</h4>
911
912 <p>The sections below describe the various types of items supported
913 by canvas widgets. Each item type is characterized by two things:
914 first, the form of the <b>create</b> command used to create
915 instances of the type; and second, a set of configuration options
916 for items of that type, which may be used in the
917 <b>create</b><span class="roman"> and </span><b>itemconfigure</b> widget commands.
918 Most items don&rsquo;t support indexing or selection or the commands
919 related to them, such as <b>index</b><span class="roman"> and </span><b>insert</b>.
920 Where items do support these facilities, it is noted explicitly
921 in the descriptions below (at present, only text items provide
922 this support).
923 </p>
924 <span id="Arc-Items"></span><h4 class="unnumberedsubsec">Arc Items</h4>
925
926 <p>Items of type <b>arc</b> appear on the display as arc-shaped regions.
927 An arc is a section of an oval delimited by two angles (specified
928 by the <b>:start</b><span class="roman"> and </span><b>:extent</b> options) and displayed in
929 one of several ways (specified by the <b>:style</b> option).
930 Arcs are created with widget commands of the following form:
931 </p>
932 <dl compact="compact">
933 <dt><i>pathName </i><b>:create arc </b><i>x1 y1 x2 y2 </i><span class="roman">?</span><i>option value option value ...</i>?</dt>
934 <dd><p>The arguments <i>x1</i><span class="roman">, </span><i>y1</i><span class="roman">, </span><i>x2</i><span class="roman">, and </span><i>y2</i> give
935 the coordinates of two diagonally opposite corners of a
936 rectangular region enclosing the oval that defines the arc.
937 After the coordinates there may be any number of <i>option</i><span class="roman">-</span><i>value</i>
938 pairs, each of which sets one of the configuration options
939 for the item. These same <i>option</i>\-<i>value</i> pairs may be
940 used in <b>itemconfigure</b> widget commands to change the item&rsquo;s
941 configuration.
942 The following options are supported for arcs:
943 </p>
944 <dl compact="compact">
945 <dt><b>:extent </b><i>degrees</i></dt>
946 <dd><p>Specifies the size of the angular range occupied by the arc.
947 The arc&rsquo;s range extends for <i>degrees</i> degrees counter-clockwise
948 from the starting angle given by the <b>:start</b> option.
949 <i>Degrees</i> may be negative.
950 </p></dd>
951 <dt><b>:fill </b><i>color</i></dt>
952 <dd><p>Fill the region of the arc with <i>color</i>.
953 <i>Color</i><span class="roman"> may have any of the forms accepted by </span><b>Tk_GetColor</b>.
954 If <i>color</i> is an empty string (the default), then
955 then the arc will not be filled.
956 </p></dd>
957 <dt><b>:outline </b><i>color</i></dt>
958 <dd><p><i>Color</i> specifies a color to use for drawing the arc&rsquo;s
959 outline; it may have any of the forms accepted by <b>Tk_GetColor</b>.
960 This option defaults to <b>black</b>. If the arc&rsquo;s style is
961 <b>arc</b> then this option is ignored (the section of perimeter is
962 filled using the <b>:fill</b><span class="roman"> option). If </span><i>color</i> is specified
963 as an empty string then no outline is drawn for the arc.
964 </p></dd>
965 <dt><b>:start </b><i>degrees</i></dt>
966 <dd><p>Specifies the beginning of the angular range occupied by the
967 arc.
968 <i>Degrees</i> is given in units of degrees measured counter-clockwise
969 from the 3-o&rsquo;clock position; it may be either positive or negative.
970 </p></dd>
971 <dt><b>:stipple </b><i>bitmap</i></dt>
972 <dd><p>Indicates that the arc should be filled in a stipple pattern;
973 <i>bitmap</i> specifies the stipple pattern to use, in any of the
974 forms accepted by <b>Tk_GetBitmap</b>.
975 If the <b>:fill</b> option hasn&rsquo;t been specified then this option
976 has no effect.
977 If <i>bitmap</i> is an empty string (the default), then filling is done
978 in a solid fashion.
979 </p></dd>
980 <dt><b>:style </b><i>type</i></dt>
981 <dd><p>Specifies how to draw the arc. If <i>type</i><span class="roman"> is </span><b>pieslice</b>
982 (the default) then the arc&rsquo;s region is defined by a section
983 of the oval&rsquo;s perimeter plus two line segments, one between the center
984 of the oval and each end of the perimeter section.
985 If <i>type</i><span class="roman"> is </span><b>chord</b> then the arc&rsquo;s region is defined
986 by a section of the oval&rsquo;s perimeter plus a single line segment
987 connecting the two end points of the perimeter section.
988 If <i>type</i><span class="roman"> is </span><b>arc</b> then the arc&rsquo;s region consists of
989 a section of the perimeter alone. In this last case there is
990 no outline for the arc and the <b>:outline</b> option is ignored.
991 </p></dd>
992 <dt><b>:tags </b><i>tagList</i></dt>
993 <dd><p>Specifies a set of tags to apply to the item.
994 <i>TagList</i> consists of a list of tag names, which replace any
995 existing tags for the item.
996 <i>TagList</i> may be an empty list.
997 </p></dd>
998 <dt><b>:width </b><i>outlineWidth</i></dt>
999 <dd><p>Specifies the width of the outline to be drawn around
1000 the arc&rsquo;s region, in any of the forms described in the COORDINATES
1001 section above.
1002 If the <b>:outline</b> option has been specified as an empty string
1003 then this option has no effect.
1004 Wide outlines will be drawn centered on the edges of the arc&rsquo;s region.
1005 This option defaults to 1.0.
1006 </p></dd>
1007 </dl>
1008 </dd>
1009 </dl>
1010
1011 <span id="Bitmap-Items"></span><h4 class="unnumberedsubsec">Bitmap Items</h4>
1012
1013 <p>Items of type <b>bitmap</b> appear on the display as images with
1014 two colors, foreground and background.
1015 Bitmaps are created with widget commands of the following form:
1016 </p>
1017 <dl compact="compact">
1018 <dt><i>pathName </i><b>:create bitmap </b><i>x y </i><span class="roman">?</span><i>option value option value ...</i>?</dt>
1019 <dd><p>The arguments <i>x</i><span class="roman"> and </span><i>y</i> specify the coordinates of a
1020 point used to position the bitmap on the display (see the <b>:anchor</b>
1021 option below for more information on how bitmaps are displayed).
1022 After the coordinates there may be any number of <i>option</i><span class="roman">-</span><i>value</i>
1023 pairs, each of which sets one of the configuration options
1024 for the item. These same <i>option</i>\-<i>value</i> pairs may be
1025 used in <b>itemconfigure</b> widget commands to change the item&rsquo;s
1026 configuration.
1027 The following options are supported for bitmaps:
1028 </p>
1029 <dl compact="compact">
1030 <dt><b>:anchor </b><i>anchorPos</i></dt>
1031 <dd><p><i>AnchorPos</i> tells how to position the bitmap relative to the
1032 positioning point for the item; it may have any of the forms
1033 accepted by <b>Tk_GetAnchor</b><span class="roman">. For example, if </span><i>anchorPos</i>
1034 is <b>center</b> then the bitmap is centered on the point; if
1035 <i>anchorPos</i><span class="roman"> is </span><b>n</b> then the bitmap will be drawn so that
1036 its top center point is at the positioning point.
1037 This option defaults to <b>center</b>.
1038 </p></dd>
1039 <dt><b>:background </b><i>color</i></dt>
1040 <dd><p>Specifies a color to use for each of the bitmap pixels
1041 whose value is 0.
1042 <i>Color</i><span class="roman"> may have any of the forms accepted by </span><b>Tk_GetColor</b>.
1043 If this option isn&rsquo;t specified, or if it is specified as an empty
1044 string, then the background color for the canvas is used.
1045 </p></dd>
1046 <dt><b>:bitmap </b><i>bitmap</i></dt>
1047 <dd><p>Specifies the bitmap to display in the item.
1048 <i>Bitmap</i><span class="roman"> may have any of the forms accepted by </span><b>Tk_GetBitmap</b>.
1049 </p></dd>
1050 <dt><b>:foreground </b><i>color</i></dt>
1051 <dd><p>Specifies a color to use for each of the bitmap pixels
1052 whose value is 1.
1053 <i>Color</i><span class="roman"> may have any of the forms accepted by </span><b>Tk_GetColor</b> and
1054 defaults to <b>black</b>.
1055 </p></dd>
1056 <dt><b>:tags </b><i>tagList</i></dt>
1057 <dd><p>Specifies a set of tags to apply to the item.
1058 <i>TagList</i> consists of a list of tag names, which replace any
1059 existing tags for the item.
1060 <i>TagList</i> may be an empty list.
1061 </p></dd>
1062 </dl>
1063 </dd>
1064 </dl>
1065 <span id="Line-Items"></span><h4 class="unnumberedsubsec">Line Items</h4>
1066
1067 <p>Items of type <b>line</b> appear on the display as one or more connected
1068 line segments or curves.
1069 Lines are created with widget commands of the following form:
1070 </p>
1071 <dl compact="compact">
1072 <dt><i>pathName </i><b>:create line </b><i>x1 y1... xn yn </i><span class="roman">?</span><i>option value option value ...</i>?</dt>
1073 <dd>
1074 <p>The arguments <i>x1</i><span class="roman"> through </span><i>yn</i> give
1075 the coordinates for a series of two or more points that describe
1076 a series of connected line segments.
1077 After the coordinates there may be any number of <i>option</i><span class="roman">-</span><i>value</i>
1078 pairs, each of which sets one of the configuration options
1079 for the item. These same <i>option</i>\-<i>value</i> pairs may be
1080 used in <b>itemconfigure</b> widget commands to change the item&rsquo;s
1081 configuration.
1082 The following options are supported for lines:
1083 </p>
1084 <dl compact="compact">
1085 <dt><b>:arrow </b><i>where</i></dt>
1086 <dd><p>Indicates whether or not arrowheads are to be drawn at one or both
1087 ends of the line.
1088 <i>Where</i><span class="roman"> must have one of the values </span><b>none</b> (for no arrowheads),
1089 <b>first</b> (for an arrowhead at the first point of the line),
1090 <b>last</b> (for an arrowhead at the last point of the line), or
1091 <b>both</b> (for arrowheads at both ends).
1092 This option defaults to <b>none</b>.
1093 </p></dd>
1094 <dt><b>:arrowshape </b><i>shape</i></dt>
1095 <dd><p>This option indicates how to draw arrowheads.
1096 The <i>shape</i> argument must be a list with three elements, each
1097 specifying a distance in any of the forms described in
1098 the COORDINATES section above.
1099 The first element of the list gives the distance along the line
1100 from the neck of the arrowhead to its tip.
1101 The second element gives the distance along the line from the
1102 trailing points of the arrowhead to the tip, and the third
1103 element gives the distance from the outside edge of the line to the
1104 trailing points.
1105 If this option isn&rsquo;t specified then Tk picks a &ldquo;reasonable&rdquo; shape.
1106 </p></dd>
1107 <dt><b>:capstyle </b><i>style</i></dt>
1108 <dd><p>Specifies the ways in which caps are to be drawn at the endpoints
1109 of the line.
1110 <i>Style</i><span class="roman"> may have any of the forms accepted by </span><b>Tk_GetCapStyle</b>
1111 (<b>butt</b><span class="roman">, </span><b>projecting</b><span class="roman">, or </span><b>round</b>).
1112 If this option isn&rsquo;t specified then it defaults to <b>butt</b>.
1113 Where arrowheads are drawn the cap style is ignored.
1114 </p></dd>
1115 <dt><b>:fill </b><i>color</i></dt>
1116 <dd><p><i>Color</i> specifies a color to use for drawing the line; it may have
1117 any of the forms acceptable to <b>Tk_GetColor</b>. It may also be an
1118 empty string, in which case the line will be transparent.
1119 This option defaults to <b>black</b>.
1120 </p></dd>
1121 <dt><b>:joinstyle </b><i>style</i></dt>
1122 <dd><p>Specifies the ways in which joints are to be drawn at the vertices
1123 of the line.
1124 <i>Style</i><span class="roman"> may have any of the forms accepted by </span><b>Tk_GetCapStyle</b>
1125 (<b>bevel</b><span class="roman">, </span><b>miter</b><span class="roman">, or </span><b>round</b>).
1126 If this option isn&rsquo;t specified then it defaults to <b>miter</b>.
1127 If the line only contains two points then this option is
1128 irrelevant.
1129 </p></dd>
1130 <dt><b>:smooth </b><i>boolean</i></dt>
1131 <dd><p><i>Boolean</i><span class="roman"> must have one of the forms accepted by </span><b>Tk_GetBoolean</b>.
1132 It indicates whether or not the line should be drawn as a curve.
1133 If so, the line is rendered as a set of Bezier splines: one spline
1134 is drawn for the first and second line segments, one for the second
1135 and third, and so on. Straight-line segments can be generated within
1136 a curve by duplicating the end-points of the desired line segment.
1137 </p></dd>
1138 <dt><b>:splinesteps </b><i>number</i></dt>
1139 <dd><p>Specifies the degree of smoothness desired for curves: each spline
1140 will be approximated with <i>number</i> line segments. This
1141 option is ignored unless the <b>:smooth</b> option is true.
1142 </p></dd>
1143 <dt><b>:stipple </b><i>bitmap</i></dt>
1144 <dd><p>Indicates that the line should be filled in a stipple pattern;
1145 <i>bitmap</i> specifies the stipple pattern to use, in any of the
1146 forms accepted by <b>Tk_GetBitmap</b>.
1147 If <i>bitmap</i> is an empty string (the default), then filling is
1148 done in a solid fashion.
1149 </p></dd>
1150 <dt><b>:tags </b><i>tagList</i></dt>
1151 <dd><p>Specifies a set of tags to apply to the item.
1152 <i>TagList</i> consists of a list of tag names, which replace any
1153 existing tags for the item.
1154 <i>TagList</i> may be an empty list.
1155 </p></dd>
1156 <dt><b>:width </b><i>lineWidth</i></dt>
1157 <dd><p><i>LineWidth</i> specifies the width of the line, in any of the forms
1158 described in the COORDINATES section above.
1159 Wide lines will be drawn centered on the path specified by the
1160 points.
1161 If this option isn&rsquo;t specified then it defaults to 1.0.
1162 </p></dd>
1163 </dl>
1164 </dd>
1165 </dl>
1166 <span id="Oval-Items"></span><h4 class="unnumberedsubsec">Oval Items</h4>
1167
1168 <p>Items of type <b>oval</b> appear as circular or oval regions on
1169 the display. Each oval may have an outline, a fill, or
1170 both. Ovals are created with widget commands of the
1171 following form:
1172 </p>
1173 <dl compact="compact">
1174 <dt><i>pathName </i><b>:create oval </b><i>x1 y1 x2 y2 </i><span class="roman">?</span><i>option value option value ...</i>?</dt>
1175 <dd>
1176 <p>The arguments <i>x1</i><span class="roman">, </span><i>y1</i><span class="roman">, </span><i>x2</i><span class="roman">, and </span><i>y2</i> give
1177 the coordinates of two diagonally opposite corners of a
1178 rectangular region enclosing the oval.
1179 The oval will include the top and left edges of the rectangle
1180 not the lower or right edges.
1181 If the region is square then the resulting oval is circular;
1182 otherwise it is elongated in shape.
1183 After the coordinates there may be any number of <i>option</i><span class="roman">-</span><i>value</i>
1184 pairs, each of which sets one of the configuration options
1185 for the item. These same <i>option</i>\-<i>value</i> pairs may be
1186 used in <b>itemconfigure</b> widget commands to change the item&rsquo;s
1187 configuration.
1188 The following options are supported for ovals:
1189 </p>
1190 <dl compact="compact">
1191 <dt><b>:fill </b><i>color</i></dt>
1192 <dd><p>Fill the area of the oval with <i>color</i>.
1193 <i>Color</i><span class="roman"> may have any of the forms accepted by </span><b>Tk_GetColor</b>.
1194 If <i>color</i> is an empty string (the default), then
1195 then the oval will not be filled.
1196 </p></dd>
1197 <dt><b>:outline </b><i>color</i></dt>
1198 <dd><p><i>Color</i> specifies a color to use for drawing the oval&rsquo;s
1199 outline; it may have any of the forms accepted by <b>Tk_GetColor</b>.
1200 This option defaults to <b>black</b>.
1201 If <i>color</i> is an empty string then no outline will be
1202 drawn for the oval.
1203 </p></dd>
1204 <dt><b>:stipple </b><i>bitmap</i></dt>
1205 <dd><p>Indicates that the oval should be filled in a stipple pattern;
1206 <i>bitmap</i> specifies the stipple pattern to use, in any of the
1207 forms accepted by <b>Tk_GetBitmap</b>.
1208 If the <b>:fill</b> option hasn&rsquo;t been specified then this option
1209 has no effect.
1210 If <i>bitmap</i> is an empty string (the default), then filling is done
1211 in a solid fashion.
1212 </p></dd>
1213 <dt><b>:tags </b><i>tagList</i></dt>
1214 <dd><p>Specifies a set of tags to apply to the item.
1215 <i>TagList</i> consists of a list of tag names, which replace any
1216 existing tags for the item.
1217 <i>TagList</i> may be an empty list.
1218 </p></dd>
1219 <dt><b>:width </b><i>outlineWidth</i></dt>
1220 <dd><p><i>outlineWidth</i> specifies the width of the outline to be drawn around
1221 the oval, in any of the forms described in the COORDINATES section above.
1222 If the <b>:outline</b> option hasn&rsquo;t been specified then this option
1223 has no effect.
1224 Wide outlines are drawn centered on the oval path defined by
1225 <i>x1</i><span class="roman">, </span><i>y1</i><span class="roman">, </span><i>x2</i><span class="roman">, and </span><i>y2</i>.
1226 This option defaults to 1.0.
1227 </p></dd>
1228 </dl>
1229 </dd>
1230 </dl>
1231 <span id="Polygon-Items"></span><h4 class="unnumberedsubsec">Polygon Items</h4>
1232
1233 <p>Items of type <b>polygon</b> appear as polygonal or curved filled regions
1234 on the display.
1235 Polygons are created with widget commands of the following form:
1236 </p>
1237 <dl compact="compact">
1238 <dt><i>pathName </i><b>:create polygon </b><i>x1 y1 ... xn yn </i><span class="roman">?</span><i>option value option value ...</i>?</dt>
1239 <dd>
1240
1241 <p>The arguments <i>x1</i><span class="roman"> through </span><i>yn</i> specify the coordinates for
1242 three or more points that define a closed polygon.
1243 The first and last points may be the same; whether they are or not,
1244 Tk will draw the polygon as a closed polygon.
1245 After the coordinates there may be any number of <i>option</i><span class="roman">-</span><i>value</i>
1246 pairs, each of which sets one of the configuration options
1247 for the item. These same <i>option</i>\-<i>value</i> pairs may be
1248 used in <b>itemconfigure</b> widget commands to change the item&rsquo;s
1249 configuration.
1250 The following options are supported for polygons:
1251 </p>
1252 <dl compact="compact">
1253 <dt><b>:fill </b><i>color</i></dt>
1254 <dd><p><i>Color</i> specifies a color to use for filling the area of the
1255 polygon; it may have any of the forms acceptable to <b>Tk_GetColor</b>.
1256 If <i>color</i> is an empty string then the polygon will be
1257 transparent.
1258 This option defaults to <b>black</b>.
1259 </p></dd>
1260 <dt><b>:smooth </b><i>boolean</i></dt>
1261 <dd><p><i>Boolean</i><span class="roman"> must have one of the forms accepted by </span><b>Tk_GetBoolean</b>
1262 It indicates whether or not the polygon should be drawn with a
1263 curved perimeter.
1264 If so, the outline of the polygon becomes a set of Bezier splines,
1265 one spline for the first and second line segments, one for the second
1266 and third, and so on. Straight-line segments can be generated in a
1267 smoothed polygon by duplicating the end-points of the desired line segment.
1268 </p></dd>
1269 <dt><b>:splinesteps </b><i>number</i></dt>
1270 <dd><p>Specifies the degree of smoothness desired for curves: each spline
1271 will be approximated with <i>number</i> line segments. This
1272 option is ignored unless the <b>:smooth</b> option is true.
1273 </p></dd>
1274 <dt><b>:stipple </b><i>bitmap</i></dt>
1275 <dd><p>Indicates that the polygon should be filled in a stipple pattern;
1276 <i>bitmap</i> specifies the stipple pattern to use, in any of the
1277 forms accepted by <b>Tk_GetBitmap</b>.
1278 If <i>bitmap</i> is an empty string (the default), then filling is
1279 done in a solid fashion.
1280 </p></dd>
1281 <dt><b>:tags </b><i>tagList</i></dt>
1282 <dd><p>Specifies a set of tags to apply to the item.
1283 <i>TagList</i> consists of a list of tag names, which replace any
1284 existing tags for the item.
1285 <i>TagList</i> may be an empty list.
1286 </p></dd>
1287 </dl>
1288 </dd>
1289 </dl>
1290
1291 <span id="Rectangle-Items"></span><h4 class="unnumberedsubsec">Rectangle Items</h4>
1292
1293 <p>Items of type <b>rectangle</b> appear as rectangular regions on
1294 the display. Each rectangle may have an outline, a fill, or
1295 both. Rectangles are created with widget commands of the
1296 following form:
1297 </p>
1298 <dl compact="compact">
1299 <dt><i>pathName </i><b>:create rectangle </b><i>x1 y1 x2 y2 </i><span class="roman">?</span><i>option value option value ...</i>?</dt>
1300 <dd>
1301 <p>The arguments <i>x1</i><span class="roman">, </span><i>y1</i><span class="roman">, </span><i>x2</i><span class="roman">, and </span><i>y2</i> give
1302 the coordinates of two diagonally opposite corners of the rectangle
1303 (the rectangle will include its upper and left edges but not
1304 its lower or right edges).
1305 After the coordinates there may be any number of <i>option</i><span class="roman">-</span><i>value</i>
1306 pairs, each of which sets one of the configuration options
1307 for the item. These same <i>option</i>\-<i>value</i> pairs may be
1308 used in <b>itemconfigure</b> widget commands to change the item&rsquo;s
1309 configuration.
1310 The following options are supported for rectangles:
1311 </p>
1312 <dl compact="compact">
1313 <dt><b>:fill </b><i>color</i></dt>
1314 <dd><p>Fill the area of the rectangle with <i>color</i>, which may be
1315 specified in any of the forms accepted by <b>Tk_GetColor</b>.
1316 If <i>color</i> is an empty string (the default), then
1317 then the rectangle will not be filled.
1318 </p></dd>
1319 <dt><b>:outline </b><i>color</i></dt>
1320 <dd><p>Draw an outline around the edge of the rectangle in <i>color</i>.
1321 <i>Color</i><span class="roman"> may have any of the forms accepted by </span><b>Tk_GetColor</b>.
1322 This option defaults to <b>black</b>.
1323 If <i>color</i> is an empty string then no outline will be
1324 drawn for the rectangle.
1325 </p></dd>
1326 <dt><b>:stipple </b><i>bitmap</i></dt>
1327 <dd><p>Indicates that the rectangle should be filled in a stipple pattern;
1328 <i>bitmap</i> specifies the stipple pattern to use, in any of the
1329 forms accepted by <b>Tk_GetBitmap</b>.
1330 If the <b>:fill</b> option hasn&rsquo;t been specified then this option
1331 has no effect.
1332 If <i>bitmap</i> is an empty string (the default), then filling
1333 is done in a solid fashion.
1334 </p></dd>
1335 <dt><b>:tags </b><i>tagList</i></dt>
1336 <dd><p>Specifies a set of tags to apply to the item.
1337 <i>TagList</i> consists of a list of tag names, which replace any
1338 existing tags for the item.
1339 <i>TagList</i> may be an empty list.
1340 </p></dd>
1341 <dt><b>:width </b><i>outlineWidth</i></dt>
1342 <dd><p><i>OutlineWidth</i> specifies the width of the outline to be drawn around
1343 the rectangle, in any of the forms described in the COORDINATES section above.
1344 If the <b>:outline</b> option hasn&rsquo;t been specified then this option
1345 has no effect.
1346 Wide outlines are drawn centered on the rectangular path
1347 defined by <i>x1</i><span class="roman">, </span><i>y1</i><span class="roman">, </span><i>x2</i><span class="roman">, and </span><i>y2</i>.
1348 This option defaults to 1.0.
1349 </p></dd>
1350 </dl>
1351 </dd>
1352 </dl>
1353 <span id="Text-Items"></span><h4 class="unnumberedsubsec">Text Items</h4>
1354
1355 <p>A text item displays a string of characters on the screen in one
1356 or more lines.
1357 Text items support indexing and selection, along with the
1358 following text-related canvas widget commands: <b>dchars</b>,
1359 <b>focus</b><span class="roman">, </span><b>icursor</b><span class="roman">, </span><b>index</b><span class="roman">, </span><b>insert</b>,
1360 <b>select</b>.
1361 Text items are created with widget commands of the following
1362 form:
1363 </p>
1364 <dl compact="compact">
1365 <dt><i>pathName </i><b>:create text </b><i>x y </i><span class="roman">?</span><i>option value option value ...</i>?</dt>
1366 <dd>
1367 <p>The arguments <i>x</i><span class="roman"> and </span><i>y</i> specify the coordinates of a
1368 point used to position the text on the display (see the options
1369 below for more information on how text is displayed).
1370 After the coordinates there may be any number of <i>option</i><span class="roman">-</span><i>value</i>
1371 pairs, each of which sets one of the configuration options
1372 for the item. These same <i>option</i>\-<i>value</i> pairs may be
1373 used in <b>itemconfigure</b> widget commands to change the item&rsquo;s
1374 configuration.
1375 The following options are supported for text items:
1376 </p>
1377 <dl compact="compact">
1378 <dt><b>:anchor </b><i>anchorPos</i></dt>
1379 <dd><p><i>AnchorPos</i> tells how to position the text relative to the
1380 positioning point for the text; it may have any of the forms
1381 accepted by <b>Tk_GetAnchor</b><span class="roman">. For example, if </span><i>anchorPos</i>
1382 is <b>center</b> then the text is centered on the point; if
1383 <i>anchorPos</i><span class="roman"> is </span><b>n</b> then the text will be drawn such that
1384 the top center point of the rectangular region occupied by the
1385 text will be at the positioning point.
1386 This option defaults to <b>center</b>.
1387 </p></dd>
1388 <dt><b>:fill </b><i>color</i></dt>
1389 <dd><p><i>Color</i> specifies a color to use for filling the text characters;
1390 it may have any of the forms accepted by <b>Tk_GetColor</b>.
1391 If this option isn&rsquo;t specified then it defaults to <b>black</b>.
1392 </p></dd>
1393 <dt><b>:font </b><i>fontName</i></dt>
1394 <dd><p>Specifies the font to use for the text item.
1395 <i>FontName</i><span class="roman"> may be any string acceptable to </span><b>Tk_GetFontStruct</b>.
1396 If this option isn&rsquo;t specified, it defaults to a system-dependent
1397 font.
1398 </p></dd>
1399 <dt><b>:justify </b><i>how</i></dt>
1400 <dd><p>Specifies how to justify the text within its bounding region.
1401 <i>How</i><span class="roman"> must be one of the values </span><b>left</b><span class="roman">, </span><b>right</b>,
1402 or <b>center</b>.
1403 This option will only matter if the text is displayed as multiple
1404 lines.
1405 If the option is omitted, it defaults to <b>left</b>.
1406 </p></dd>
1407 <dt><b>:stipple </b><i>bitmap</i></dt>
1408 <dd><p>Indicates that the text should be drawn in a stippled pattern
1409 rather than solid;
1410 <i>bitmap</i> specifies the stipple pattern to use, in any of the
1411 forms accepted by <b>Tk_GetBitmap</b>.
1412 If <i>bitmap</i> is an empty string (the default) then the text
1413 is drawn in a solid fashion.
1414 </p></dd>
1415 <dt><b>:tags </b><i>tagList</i></dt>
1416 <dd><p>Specifies a set of tags to apply to the item.
1417 <i>TagList</i> consists of a list of tag names, which replace any
1418 existing tags for the item.
1419 <i>TagList</i> may be an empty list.
1420 </p></dd>
1421 <dt><b>:text </b><i>string</i></dt>
1422 <dd><p><i>String</i> specifies the characters to be displayed in the text item.
1423 Newline characters cause line breaks.
1424 The characters in the item may also be changed with the
1425 <b>insert</b><span class="roman"> and </span><b>delete</b> widget commands.
1426 This option defaults to an empty string.
1427 </p></dd>
1428 <dt><b>:width </b><i>lineLength</i></dt>
1429 <dd><p>Specifies a maximum line length for the text, in any of the forms
1430 described in the COORDINATES section abov.
1431 If this option is zero (the default) the text is broken into
1432 lines only at newline characters.
1433 However, if this option is non-zero then any line that would
1434 be longer than <i>lineLength</i> is broken just before a space
1435 character to make the line shorter than <i>lineLength</i>; the
1436 space character is treated as if it were a newline
1437 character.
1438 </p>
1439 </dd>
1440 </dl>
1441 </dd>
1442 </dl>
1443 <span id="Window-Items"></span><h4 class="unnumberedsubsec">Window Items</h4>
1444
1445 <p>Items of type <b>window</b> cause a particular window to be displayed
1446 at a given position on the canvas.
1447 Window items are created with widget commands of the following form:
1448 </p>
1449 <div class="example">
1450 <pre class="example"><i>pathName </i><b>:create window </b><i>x y </i><span class="roman">?</span><i>option value option value ...</i>?
1451 </pre></div>
1452
1453 <p>The arguments <i>x</i><span class="roman"> and </span><i>y</i> specify the coordinates of a
1454 point used to position the window on the display (see the <b>:anchor</b>
1455 option below for more information on how bitmaps are displayed).
1456 After the coordinates there may be any number of <i>option</i><span class="roman">-</span><i>value</i>
1457 pairs, each of which sets one of the configuration options
1458 for the item. These same <i>option</i>\-<i>value</i> pairs may be
1459 used in <b>itemconfigure</b> widget commands to change the item&rsquo;s
1460 configuration.
1461 The following options are supported for window items:
1462 </p>
1463 <dl compact="compact">
1464 <dt><b>:anchor </b><i>anchorPos</i></dt>
1465 <dd><p><i>AnchorPos</i> tells how to position the window relative to the
1466 positioning point for the item; it may have any of the forms
1467 accepted by <b>Tk_GetAnchor</b><span class="roman">. For example, if </span><i>anchorPos</i>
1468 is <b>center</b> then the window is centered on the point; if
1469 <i>anchorPos</i><span class="roman"> is </span><b>n</b> then the window will be drawn so that
1470 its top center point is at the positioning point.
1471 This option defaults to <b>center</b>.
1472 </p></dd>
1473 <dt><b>:height </b><i>pixels</i></dt>
1474 <dd><p>Specifies the height to assign to the item&rsquo;s window.
1475 <i>Pixels</i> may have any of the
1476 forms described in the COORDINATES section above.
1477 If this option isn&rsquo;t specified, or if it is specified as an empty
1478 string, then the window is given whatever height it requests internally.
1479 </p></dd>
1480 <dt><b>:tags </b><i>tagList</i></dt>
1481 <dd><p>Specifies a set of tags to apply to the item.
1482 <i>TagList</i> consists of a list of tag names, which replace any
1483 existing tags for the item.
1484 <i>TagList</i> may be an empty list.
1485 </p></dd>
1486 <dt><b>:width </b><i>pixels</i></dt>
1487 <dd><p>Specifies the width to assign to the item&rsquo;s window.
1488 <i>Pixels</i> may have any of the
1489 forms described in the COORDINATES section above.
1490 If this option isn&rsquo;t specified, or if it is specified as an empty
1491 string, then the window is given whatever width it requests internally.
1492 </p></dd>
1493 <dt><b>:window </b><i>pathName</i></dt>
1494 <dd><p>Specifies the window to associate with this item.
1495 The window specified by <i>pathName</i> must either be a child of
1496 the canvas widget or a child of some ancestor of the canvas widget.
1497 <i>PathName</i> may not refer to a top-level window.
1498 </p>
1499 </dd>
1500 </dl>
1501 <span id="Application_002dDefined-Item-Types"></span><h4 class="unnumberedsubsec">Application-Defined Item Types</h4>
1502
1503 <p>It is possible for individual applications to define new item
1504 types for canvas widgets using C code.
1505 The interfaces for this mechanism are not presently documented,
1506 and it&rsquo;s possible they may change, but you should be able to
1507 see how they work by examining the code for some of the existing
1508 item types.
1509 </p>
1510 <span id="Bindings-1"></span><h4 class="unnumberedsubsec">Bindings</h4>
1511
1512 <p>In the current implementation, new canvases are not given any
1513 default behavior: you&rsquo;ll have to execute explicit Tcl commands
1514 to give the canvas its behavior.
1515 </p>
1516 <span id="Credits"></span><h4 class="unnumberedsubsec">Credits</h4>
1517
1518 <p>Tk&rsquo;s canvas widget is a blatant ripoff of ideas from Joel Bartlett&rsquo;s
1519 <i>ezd</i><span class="roman"> program. </span><i>Ezd</i> provides structured graphics in a Scheme
1520 environment and preceded canvases by a year or two. Its simple
1521 mechanisms for placing and animating graphical objects inspired the
1522 functions of canvases.
1523 </p>
1524 <span id="Keywords-3"></span><h4 class="unnumberedsubsec">Keywords</h4>
1525 <p>canvas, widget
1526 </p><hr>
1527 <div class="header">
1528 <p>
1529 Next: <a href="menu.html" accesskey="n" rel="next">menu</a>, Previous: <a href="scale.html" accesskey="p" rel="prev">scale</a>, Up: <a href="Widgets.html" accesskey="u" rel="up">Widgets</a> &nbsp; [<a href="wm.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>]</p>
1530 </div>
1531
1532
1533
1534 </body>
1535 </html>