This file is indexed.

/usr/share/doc/gcl-doc/gcl-tk/canvas.html is in gcl-doc 2.6.10-2.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

   1
   2
   3
   4
   5
   6
   7
   8
   9
  10
  11
  12
  13
  14
  15
  16
  17
  18
  19
  20
  21
  22
  23
  24
  25
  26
  27
  28
  29
  30
  31
  32
  33
  34
  35
  36
  37
  38
  39
  40
  41
  42
  43
  44
  45
  46
  47
  48
  49
  50
  51
  52
  53
  54
  55
  56
  57
  58
  59
  60
  61
  62
  63
  64
  65
  66
  67
  68
  69
  70
  71
  72
  73
  74
  75
  76
  77
  78
  79
  80
  81
  82
  83
  84
  85
  86
  87
  88
  89
  90
  91
  92
  93
  94
  95
  96
  97
  98
  99
 100
 101
 102
 103
 104
 105
 106
 107
 108
 109
 110
 111
 112
 113
 114
 115
 116
 117
 118
 119
 120
 121
 122
 123
 124
 125
 126
 127
 128
 129
 130
 131
 132
 133
 134
 135
 136
 137
 138
 139
 140
 141
 142
 143
 144
 145
 146
 147
 148
 149
 150
 151
 152
 153
 154
 155
 156
 157
 158
 159
 160
 161
 162
 163
 164
 165
 166
 167
 168
 169
 170
 171
 172
 173
 174
 175
 176
 177
 178
 179
 180
 181
 182
 183
 184
 185
 186
 187
 188
 189
 190
 191
 192
 193
 194
 195
 196
 197
 198
 199
 200
 201
 202
 203
 204
 205
 206
 207
 208
 209
 210
 211
 212
 213
 214
 215
 216
 217
 218
 219
 220
 221
 222
 223
 224
 225
 226
 227
 228
 229
 230
 231
 232
 233
 234
 235
 236
 237
 238
 239
 240
 241
 242
 243
 244
 245
 246
 247
 248
 249
 250
 251
 252
 253
 254
 255
 256
 257
 258
 259
 260
 261
 262
 263
 264
 265
 266
 267
 268
 269
 270
 271
 272
 273
 274
 275
 276
 277
 278
 279
 280
 281
 282
 283
 284
 285
 286
 287
 288
 289
 290
 291
 292
 293
 294
 295
 296
 297
 298
 299
 300
 301
 302
 303
 304
 305
 306
 307
 308
 309
 310
 311
 312
 313
 314
 315
 316
 317
 318
 319
 320
 321
 322
 323
 324
 325
 326
 327
 328
 329
 330
 331
 332
 333
 334
 335
 336
 337
 338
 339
 340
 341
 342
 343
 344
 345
 346
 347
 348
 349
 350
 351
 352
 353
 354
 355
 356
 357
 358
 359
 360
 361
 362
 363
 364
 365
 366
 367
 368
 369
 370
 371
 372
 373
 374
 375
 376
 377
 378
 379
 380
 381
 382
 383
 384
 385
 386
 387
 388
 389
 390
 391
 392
 393
 394
 395
 396
 397
 398
 399
 400
 401
 402
 403
 404
 405
 406
 407
 408
 409
 410
 411
 412
 413
 414
 415
 416
 417
 418
 419
 420
 421
 422
 423
 424
 425
 426
 427
 428
 429
 430
 431
 432
 433
 434
 435
 436
 437
 438
 439
 440
 441
 442
 443
 444
 445
 446
 447
 448
 449
 450
 451
 452
 453
 454
 455
 456
 457
 458
 459
 460
 461
 462
 463
 464
 465
 466
 467
 468
 469
 470
 471
 472
 473
 474
 475
 476
 477
 478
 479
 480
 481
 482
 483
 484
 485
 486
 487
 488
 489
 490
 491
 492
 493
 494
 495
 496
 497
 498
 499
 500
 501
 502
 503
 504
 505
 506
 507
 508
 509
 510
 511
 512
 513
 514
 515
 516
 517
 518
 519
 520
 521
 522
 523
 524
 525
 526
 527
 528
 529
 530
 531
 532
 533
 534
 535
 536
 537
 538
 539
 540
 541
 542
 543
 544
 545
 546
 547
 548
 549
 550
 551
 552
 553
 554
 555
 556
 557
 558
 559
 560
 561
 562
 563
 564
 565
 566
 567
 568
 569
 570
 571
 572
 573
 574
 575
 576
 577
 578
 579
 580
 581
 582
 583
 584
 585
 586
 587
 588
 589
 590
 591
 592
 593
 594
 595
 596
 597
 598
 599
 600
 601
 602
 603
 604
 605
 606
 607
 608
 609
 610
 611
 612
 613
 614
 615
 616
 617
 618
 619
 620
 621
 622
 623
 624
 625
 626
 627
 628
 629
 630
 631
 632
 633
 634
 635
 636
 637
 638
 639
 640
 641
 642
 643
 644
 645
 646
 647
 648
 649
 650
 651
 652
 653
 654
 655
 656
 657
 658
 659
 660
 661
 662
 663
 664
 665
 666
 667
 668
 669
 670
 671
 672
 673
 674
 675
 676
 677
 678
 679
 680
 681
 682
 683
 684
 685
 686
 687
 688
 689
 690
 691
 692
 693
 694
 695
 696
 697
 698
 699
 700
 701
 702
 703
 704
 705
 706
 707
 708
 709
 710
 711
 712
 713
 714
 715
 716
 717
 718
 719
 720
 721
 722
 723
 724
 725
 726
 727
 728
 729
 730
 731
 732
 733
 734
 735
 736
 737
 738
 739
 740
 741
 742
 743
 744
 745
 746
 747
 748
 749
 750
 751
 752
 753
 754
 755
 756
 757
 758
 759
 760
 761
 762
 763
 764
 765
 766
 767
 768
 769
 770
 771
 772
 773
 774
 775
 776
 777
 778
 779
 780
 781
 782
 783
 784
 785
 786
 787
 788
 789
 790
 791
 792
 793
 794
 795
 796
 797
 798
 799
 800
 801
 802
 803
 804
 805
 806
 807
 808
 809
 810
 811
 812
 813
 814
 815
 816
 817
 818
 819
 820
 821
 822
 823
 824
 825
 826
 827
 828
 829
 830
 831
 832
 833
 834
 835
 836
 837
 838
 839
 840
 841
 842
 843
 844
 845
 846
 847
 848
 849
 850
 851
 852
 853
 854
 855
 856
 857
 858
 859
 860
 861
 862
 863
 864
 865
 866
 867
 868
 869
 870
 871
 872
 873
 874
 875
 876
 877
 878
 879
 880
 881
 882
 883
 884
 885
 886
 887
 888
 889
 890
 891
 892
 893
 894
 895
 896
 897
 898
 899
 900
 901
 902
 903
 904
 905
 906
 907
 908
 909
 910
 911
 912
 913
 914
 915
 916
 917
 918
 919
 920
 921
 922
 923
 924
 925
 926
 927
 928
 929
 930
 931
 932
 933
 934
 935
 936
 937
 938
 939
 940
 941
 942
 943
 944
 945
 946
 947
 948
 949
 950
 951
 952
 953
 954
 955
 956
 957
 958
 959
 960
 961
 962
 963
 964
 965
 966
 967
 968
 969
 970
 971
 972
 973
 974
 975
 976
 977
 978
 979
 980
 981
 982
 983
 984
 985
 986
 987
 988
 989
 990
 991
 992
 993
 994
 995
 996
 997
 998
 999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<!-- Created by GNU Texinfo 5.2, http://www.gnu.org/software/texinfo/ -->
<head>
<title>GCL TK Manual: canvas</title>

<meta name="description" content="GCL TK Manual: canvas">
<meta name="keywords" content="GCL TK Manual: canvas">
<meta name="resource-type" content="document">
<meta name="distribution" content="global">
<meta name="Generator" content="makeinfo">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<link href="index.html#Top" rel="start" title="Top">
<link href="wm.html#SEC_Contents" rel="contents" title="Table of Contents">
<link href="Widgets.html#Widgets" rel="up" title="Widgets">
<link href="menu.html#menu" rel="next" title="menu">
<link href="scale.html#scale" rel="prev" title="scale">
<style type="text/css">
<!--
a.summary-letter {text-decoration: none}
blockquote.smallquotation {font-size: smaller}
div.display {margin-left: 3.2em}
div.example {margin-left: 3.2em}
div.indentedblock {margin-left: 3.2em}
div.lisp {margin-left: 3.2em}
div.smalldisplay {margin-left: 3.2em}
div.smallexample {margin-left: 3.2em}
div.smallindentedblock {margin-left: 3.2em; font-size: smaller}
div.smalllisp {margin-left: 3.2em}
kbd {font-style:oblique}
pre.display {font-family: inherit}
pre.format {font-family: inherit}
pre.menu-comment {font-family: serif}
pre.menu-preformatted {font-family: serif}
pre.smalldisplay {font-family: inherit; font-size: smaller}
pre.smallexample {font-size: smaller}
pre.smallformat {font-family: inherit; font-size: smaller}
pre.smalllisp {font-size: smaller}
span.nocodebreak {white-space:nowrap}
span.nolinebreak {white-space:nowrap}
span.roman {font-family:serif; font-weight:normal}
span.sansserif {font-family:sans-serif; font-weight:normal}
ul.no-bullet {list-style: none}
-->
</style>


</head>

<body lang="en" bgcolor="#FFFFFF" text="#000000" link="#0000FF" vlink="#800080" alink="#FF0000">
<a name="canvas"></a>
<div class="header">
<p>
Next: <a href="menu.html#menu" accesskey="n" rel="next">menu</a>, Previous: <a href="scale.html#scale" accesskey="p" rel="prev">scale</a>, Up: <a href="Widgets.html#Widgets" accesskey="u" rel="up">Widgets</a> &nbsp; [<a href="wm.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>]</p>
</div>
<hr>
<a name="canvas-1"></a>
<h3 class="section">2.4 canvas</h3>

<p>canvas \- Create and manipulate canvas widgets
</p><a name="Synopsis-3"></a>
<h4 class="unnumberedsubsec">Synopsis</h4>
<p><b>canvas</b><i> </i><i>pathName </i><span class="roman">?</span><i>options</i>?
</p><a name="Standard-Options-3"></a>
<h4 class="unnumberedsubsec">Standard Options</h4>


<div class="example">
<pre class="example">background       insertBorderWidth relief            xScrollCommand 
borderWidth      insertOffTime     selectBackground  yScrollCommand 
cursor           insertOnTime      selectBorderWidth 
insertBackground insertWidth       selectForeground  
</pre></div>


<p>See <a href="options.html#options">options</a>, for more information.
</p><a name="Arguments-for-Canvas"></a>
<h4 class="unnumberedsubsec">Arguments for Canvas</h4>


<dl compact="compact">
<dt><code><b>:closeenough</b></code></dt>
<dd><p align="right">Name=<code>&quot;<b>closeEnough</b><span class="roman">&quot;</span> Class=<code>&quot;</code><b>CloseEnough</b>&quot;</code>
</p><br>

<p>Specifies a floating-point value indicating how close the mouse cursor
must be to an item before it is considered to be &ldquo;inside&rdquo; the item.
Defaults to 1.0.
</p></dd>
</dl>


<dl compact="compact">
<dt><code><b>:confine</b></code></dt>
<dd><p align="right">Name=<code>&quot;<b>confine</b><span class="roman">&quot;</span> Class=<code>&quot;</code><b>Confine</b>&quot;</code>
</p><br>

<p>Specifies a boolean value that indicates whether or not it should be
allowable to set the canvas&rsquo;s view outside the region defined by the
<b>scrollRegion</b> argument.
Defaults to true, which means that the view will
be constrained within the scroll region.
</p></dd>
</dl>


<dl compact="compact">
<dt><code><b>:height</b></code></dt>
<dd><p align="right">Name=<code>&quot;<b>height</b><span class="roman">&quot;</span> Class=<code>&quot;</code><b>Height</b>&quot;</code>
</p><br>

<p>Specifies a desired window height that the canvas widget should request from
its geometry manager.  The value may be specified in any
of the forms described in the COORDINATES section below.
</p></dd>
</dl>


<dl compact="compact">
<dt><code><b>:scrollincrement</b></code></dt>
<dd><p align="right">Name=<code>&quot;<b>scrollIncrement</b><span class="roman">&quot;</span> Class=<code>&quot;</code><b>ScrollIncrement</b>&quot;</code>
</p><br>

<p>Specifies a distance used as increment during scrolling:  when one of
the arrow buttons on an associated scrollbar is pressed, the picture
will shift by this distance.  The distance may be specified in any
of the forms described in the COORDINATES section below.
</p></dd>
</dl>


<dl compact="compact">
<dt><code><b>:scrollregion</b></code></dt>
<dd><p align="right">Name=<code>&quot;<b>scrollRegion</b><span class="roman">&quot;</span> Class=<code>&quot;</code><b>ScrollRegion</b>&quot;</code>
</p><br>

<p>Specifies a list with four coordinates describing the left, top, right, and
bottom coordinates of a rectangular region.
This region is used for scrolling purposes and is considered to be
the boundary of the information in the canvas.
Each of the coordinates may be specified
in any of the forms given in the COORDINATES section below.
</p></dd>
</dl>


<dl compact="compact">
<dt><code><b>:width</b></code></dt>
<dd><p align="right">Name=<code>&quot;<b>width</b><span class="roman">&quot;</span> Class=<code>&quot;</code><b>width</b>&quot;</code>
</p><br>

<p>Specifies a desired window width that the canvas widget should request from
its geometry manager.  The value may be specified in any
of the forms described in the COORDINATES section below.
</p></dd>
</dl>

<a name="Introduction-2"></a>
<h4 class="unnumberedsubsec">Introduction</h4>

<p>The <b>canvas</b> command creates a new window (given
by the <i>pathName</i> argument) and makes it into a canvas widget.
Additional options, described above, may be specified on the
command line or in the option database
to configure aspects of the canvas such as its colors and 3-D relief.
The <b>canvas</b> command returns its
<i>pathName</i> argument.  At the time this command is invoked,
there must not exist a window named <i>pathName</i>, but
<i>pathName</i>&rsquo;s parent must exist.
</p>
<p>Canvas widgets implement structured graphics.
A canvas displays any number of <i>items</i>, which may be things like
rectangles, circles, lines, and text.
Items may be manipulated (e.g. moved or re-colored) and commands may
be associated with items in much the same way that the <b>bind</b>
command allows commands to be bound to widgets.  For example,
a particular command may be associated with the &lt;Button-1&gt; event
so that the command is invoked whenever button 1 is pressed with
the mouse cursor over an item.
This means that items in a canvas can have behaviors defined by
the Tcl scripts bound to them.
</p>
<a name="Display-List"></a>
<h4 class="unnumberedsubsec">Display List</h4>

<p>The items in a canvas are ordered for purposes of display,
with the first item in the display list being displayed
first, followed by the next item in the list, and so on.
Items later in the display list obscure those that are
earlier in the display list and are sometimes referred to
as being &ldquo;on top&rdquo; of earlier items.
When a new item is created it is placed at the end of the
display list, on top of everything else.
Widget commands may be used to re-arrange the order of the
display list.
</p>
<a name="Item-Ids-And-Tags"></a>
<h4 class="unnumberedsubsec">Item Ids And Tags</h4>

<p>Items in a canvas widget may be named in either of two ways:
by id or by tag.
Each item has a unique identifying number which is assigned to
that item when it is created.  The id of an item never changes
and id numbers are never re-used within the lifetime of a
canvas widget.
</p>
<p>Each item may also have any number of <i>tags</i> associated
with it.  A tag is just a string of characters, and it may
take any form except that of an integer.
For example, &ldquo;x123&rdquo; is OK but &ldquo;123&rdquo; isn&rsquo;t.
The same tag may be associated with many different items.
This is commonly done to group items in various interesting
ways;  for example, all selected items might be given the
tag &ldquo;selected&rdquo;.
</p>
<p>The tag <b>all</b> is implicitly associated with every item
in the canvas;  it may be used to invoke operations on
all the items in the canvas.
</p>
<p>The tag <b>current</b> is managed automatically by Tk;
it applies to the <i>current item</i>, which is the
topmost item whose drawn area covers the position of
the mouse cursor.
If the mouse is not in the canvas widget or is not over
an item, then no item has the <b>current</b> tag.
</p>
<p>When specifying items in canvas widget commands, if the
specifier is an integer then it is assumed to refer to
the single item with that id.
If the specifier is not an integer, then it is assumed to
refer to all of the items in the canvas that have a tag
matching the specifier.
The symbol <i>tagOrId</i> is used below to indicate that
an argument specifies either an id that selects a single
item or a tag that selects zero or more items.
Some widget commands only operate on a single item at a
time;  if <i>tagOrId</i> is specified in a way that
names multiple items, then the normal behavior is for
the command to use the first (lowest) of these items in
the display list that is suitable for the command.
Exceptions are noted in the widget command descriptions
below.
</p>
<a name="Coordinates"></a>
<h4 class="unnumberedsubsec">Coordinates</h4>

<p>All coordinates related to canvases are stored as floating-point
numbers.
Coordinates and distances are specified in screen units,
which are floating-point numbers optionally followed
by one of several letters.
If no letter is supplied then the distance is in pixels.
If the letter is <b>m</b> then the distance is in millimeters on
the screen;  if it is <b>c</b> then the distance is in centimeters;
<b>i</b><span class="roman"> means inches, and </span><b>p</b> means printers points (1/72 inch).
Larger y-coordinates refer to points lower on the screen;  larger
x-coordinates refer to points farther to the right.
</p>
<a name="Transformations"></a>
<h4 class="unnumberedsubsec">Transformations</h4>

<p>Normally the origin of the canvas coordinate system is at the
upper-left corner of the window containing the canvas.
It is possible to adjust the origin of the canvas
coordinate system relative to the origin of the window using the
<b>xview</b><span class="roman"> and </span><b>yview</b> widget commands;  this is typically used
for scrolling.
Canvases do not support scaling or rotation of the canvas coordinate
system relative to the window coordinate system.
</p>
<p>Indidividual items may be moved or scaled using widget commands
described below, but they may not be rotated.
</p>
<a name="Indices"></a>
<h4 class="unnumberedsubsec">Indices</h4>

<p>Text items support the notion of an <i>index</i> for identifying
particular positions within the item.
Indices are used for commands such as inserting text, deleting
a range of characters, and setting the insertion cursor position.
An index may be specified in any of a number of ways, and
different types of items may support different forms for
specifying indices.
Text items support the following forms for an index;  if you
define new types of text-like items, it would be advisable to
support as many of these forms as practical.
Note that it is possible to refer to the character just after
the last one in the text item;  this is necessary for such
tasks as inserting new text at the end of the item.
</p>
<dl compact="compact">
<dt><i>number</i></dt>
<dd><p>A decimal number giving the position of the desired character
within the text item.
0 refers to the first character, 1 to the next character, and
so on.
A number less than 0 is treated as if it were zero, and a
number greater than the length of the text item is treated
as if it were equal to the length of the text item.
</p></dd>
<dt><b>end</b></dt>
<dd><p>Refers to the character just after the last one in the item
(same as the number of characters in the item).
</p></dd>
<dt><b>insert</b></dt>
<dd><p>Refers to the character just before which the insertion cursor
is drawn in this item.
</p></dd>
<dt><b>sel.first</b></dt>
<dd><p>Refers to the first selected character in the item.
If the selection isn&rsquo;t in this item then this form is illegal.
</p></dd>
<dt><b>sel.last</b></dt>
<dd><p>Refers to the last selected character in the item.
If the selection isn&rsquo;t in this item then this form is illegal.
</p></dd>
<dt><b>@</b><i>x,y</i></dt>
<dd><p>Refers to the character at the point given by <i>x</i> and
<i>y</i><span class="roman">, where </span><i>x</i><span class="roman"> and </span><i>y</i> are specified in the coordinate
system of the canvas.
If <i>x</i><span class="roman"> and </span><i>y</i> lie outside the coordinates covered by the
text item, then they refer to the first or last character in the
line that is closest to the given point.
</p>
</dd>
</dl>
<a name="A-Canvas-Widget_0027s-Arguments"></a>
<h4 class="unnumberedsubsec">A Canvas Widget&rsquo;s Arguments</h4>

<p>The <b>canvas</b> command creates a new Tcl command whose
name is <i>pathName</i>.  This
command may be used to invoke various
operations on the widget.  It has the following general form:
</p>
<div class="example">
<pre class="example"><i>pathName option </i><span class="roman">?</span><i>arg arg ...</i>?
</pre></div>

<p><i>Option</i><span class="roman"> and the </span><i>arg</i>s
determine the exact behavior of the command.
The following widget commands are possible for canvas widgets:
</p>
<dl compact="compact">
<dt><i>pathName </i><b>:addtag </b><i>tag searchSpec </i><span class="roman">?</span><i>arg arg ...</i>?</dt>
<dd><p>For each item that meets the constraints specified by
<i>searchSpec</i><span class="roman"> and the </span><i>arg</i>s, add
<i>tag</i> to the list of tags associated with the item if it
isn&rsquo;t already present on that list.
It is possible that no items will satisfy the constraints
given by <i>searchSpec and </i><i>arg</i>s, in which case the
command has no effect.
This command returns an empty string as result.
<i>SearchSpec</i><span class="roman"> and </span><i>arg</i>&rsquo;s may take any of the following
forms:
</p>
<dl compact="compact">
<dt><b>above </b><i>tagOrId</i></dt>
<dd><p>Selects the item just after (above) the one given by <i>tagOrId</i>
in the display list.
If <i>tagOrId</i> denotes more than one item, then the last (topmost)
of these items in the display list is used.
</p></dd>
<dt><b>all</b></dt>
<dd><p>Selects all the items in the canvas.
</p></dd>
<dt><b>below </b><i>tagOrId</i></dt>
<dd><p>Selects the item just before (below) the one given by <i>tagOrId</i>
in the display list.
If <i>tagOrId</i> denotes more than one item, then the first (lowest)
of these items in the display list is used.
</p></dd>
<dt><b>closest </b><i>x y </i><span class="roman">?</span><i>halo</i><span class="roman">? ?</span><i>start</i>?</dt>
<dd><p>Selects the item closest to the point given by <i>x</i><span class="roman"> and </span><i>y</i>.
If more than one item is at the same closest distance (e.g. two
items overlap the point), then the top-most of these items (the
last one in the display list) is used.
If <i>halo</i> is specified, then it must be a non-negative
value.
Any item closer than <i>halo</i> to the point is considered to
overlap it.
The <i>start</i> argument may be used to step circularly through
all the closest items.
If <i>start</i> is specified, it names an item using a tag or id
(if by tag, it selects the first item in the display list with
the given tag).
Instead of selecting the topmost closest item, this form will
select the topmost closest item that is below <i>start</i> in
the display list;  if no such item exists, then the selection
behaves as if the <i>start</i> argument had not been specified.
</p></dd>
<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>
<dd><p>Selects all the items completely enclosed within the rectangular
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>.
<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
no greater than <i>y2</i>.
</p></dd>
<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>
<dd><p>Selects all the items that overlap or are enclosed within the
rectangular region given by <i>x1</i><span class="roman">, </span><i>y1</i><span class="roman">, </span><i>x2</i>,
and <i>y2</i>.
<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
no greater than <i>y2</i>.
</p></dd>
<dt><b>withtag </b><i>tagOrId</i></dt>
<dd><p>Selects all the items given by <i>tagOrId</i>.
</p></dd>
</dl>

</dd>
<dt><i>pathName </i><b>:bbox </b><i>tagOrId</i><span class="roman"> ?</span><i>tagOrId tagOrId ...</i>?</dt>
<dd><p>Returns a list with four elements giving an approximate bounding box
for all the items named by the <i>tagOrId</i> arguments.
The list has the form &ldquo;<i>x1 y1 x2 y2</i>&rdquo; such that the drawn
areas of all the named elements are within the region bounded by
<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,
and <i>y2</i> on the bottom.
The return value may overestimate the actual bounding box by
a few pixels.
If no items match any of the <i>tagOrId</i> arguments then an
empty string is returned.
</p></dd>
<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>
<dd><p>This command associates <i>command</i> with all the items given by
<i>tagOrId</i> such that whenever the event sequence given by
<i>sequence</i> occurs for one of the items the command will
be invoked.
This widget command is similar to the <b>bind</b> command except that
it operates on items in a canvas rather than entire widgets.
See the <b>bind</b> manual entry for complete details
on the syntax of <i>sequence</i> and the substitutions performed
on <i>command</i> before invoking it.
If all arguments are specified then a new binding is created, replacing
any existing binding for the same <i>sequence</i><span class="roman"> and </span><i>tagOrId</i>
(if the first character of <i>command</i><span class="roman"> is &ldquo;+&rdquo; then </span><i>command</i>
augments an existing binding rather than replacing it).
In this case the return value is an empty string.
If <i>command</i><span class="roman"> is omitted then the command returns the </span><i>command</i>
associated with <i>tagOrId</i><span class="roman"> and </span><i>sequence</i> (an error occurs
if there is no such binding).
If both <i>command</i><span class="roman"> and </span><i>sequence</i> are omitted then the command
returns a list of all the sequences for which bindings have been
defined for <i>tagOrId</i>.
</p></dd>
</dl>


<p>The only events for which bindings may be specified are those related
to the mouse and keyboard, such as <b>Enter</b><span class="roman">, </span><b>Leave</b>,
<b>ButtonPress</b><span class="roman">, </span><b>Motion</b><span class="roman">, and </span><b>KeyPress</b>.
The handling of events in canvases uses the current item defined
in ITEM IDS AND TAGS above.
<b>Enter</b><span class="roman"> and </span><b>Leave</b> events trigger for an item when it
becomes the current item or ceases to be the current item;  note
that these events are different than <b>Enter</b><span class="roman"> and </span><b>Leave</b>
events for windows.
Mouse-related events are directed to the current item, if any.
Keyboard-related events are directed to the focus item, if any
(see the <b>focus</b> widget command below for more on this).
</p>

<p>It is possible for multiple commands to be bound to a single
event sequence for a single object.
This occurs, for example, if one command is associated with the
item&rsquo;s id and another is associated with one of the item&rsquo;s tags.
When this occurs, the first matching binding is used.
A binding for the item&rsquo;s id has highest priority, followed by
the oldest tag for the item and proceeding through all of the
item&rsquo;s tags up through the most-recently-added one.
If a binding is associated with the tag <b>all</b>, the binding
will have lower priority than all other bindings associated
with the item.
</p>
<dl compact="compact">
<dt><i>pathName </i><b>:canvasx </b><i>screenx</i><span class="roman"> ?</span><i>gridspacing</i>?</dt>
<dd><p>Given a screen x-coordinate <i>screenx</i> this command returns
the canvas x-coordinate that is displayed at that location.
If <i>gridspacing</i> is specified, then the canvas coordinate is
rounded to the nearest multiple of <i>gridspacing</i> units.
</p></dd>
<dt><i>pathName </i><b>:canvasy </b><i>screeny</i><span class="roman"> ?</span><i>gridspacing</i>?</dt>
<dd><p>Given a screen y-coordinate <i>screeny</i> this command returns
the canvas y-coordinate that is displayed at that location.
If <i>gridspacing</i> is specified, then the canvas coordinate is
rounded to the nearest multiple of <i>gridspacing</i> units.
</p></dd>
<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>
<dd><p>Query or modify the configuration options of the widget.
If no <i>option</i> is specified, returns a list describing all of
the available options for <i>pathName</i><span class="roman"> (see </span><b>Tk_ConfigureInfo</b> for
information on the format of this list).  If <i>option</i> is specified
with no <i>value</i>, then the command returns a list describing the
one named option (this list will be identical to the corresponding
sublist of the value returned if no <i>option</i> is specified).  If
one or more <i>option:value</i> pairs are specified, then the command
modifies the given widget option(s) to have the given value(s);  in
this case the command returns an empty string.
<i>Option</i><span class="roman"> may have any of the values accepted by the </span><b>canvas</b>
command.
</p></dd>
<dt><i>pathName</i><span class="roman"> </span><b>:coords </b><i>tagOrId </i><span class="roman">?</span><i>x0 y0 ...</i>?</dt>
<dd><p>Query or modify the coordinates that define an item.
If no coordinates are specified, this command returns a list
whose elements are the coordinates of the item named by
<i>tagOrId</i>.
If coordinates are specified, then they replace the current
coordinates for the named item.
If <i>tagOrId</i> refers to multiple items, then
the first one in the display list is used.
</p></dd>
<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>
<dd><p>Create a new item in <i>pathName</i><span class="roman"> of type </span><i>type</i>.
The exact format of the arguments after <b>type</b> depends
on <b>type</b>, but usually they consist of the coordinates for
one or more points, followed by specifications for zero or
more item options.
See the subsections on individual item types below for more
on the syntax of this command.
This command returns the id for the new item.
</p></dd>
<dt><i>pathName </i><b>:dchars </b><i>tagOrId first </i><span class="roman">?</span><i>last</i>?</dt>
<dd><p>For each item given by <i>tagOrId</i>, delete the characters
in the range given by <i>first</i><span class="roman"> and </span><i>last</i>,
inclusive.
If some of the items given by <i>tagOrId</i> don&rsquo;t support
text operations, then they are ignored.
<i>First</i><span class="roman"> and </span><i>last</i> are indices of characters
within the item(s) as described in INDICES above.
If <i>last</i><span class="roman"> is omitted, it defaults to </span><i>first</i>.
This command returns an empty string.
</p></dd>
<dt><i>pathName </i><b>:delete </b><span class="roman">?</span><i>tagOrId tagOrId ...</i>?</dt>
<dd><p>Delete each of the items given by each <i>tagOrId</i>, and return
an empty string.
</p></dd>
<dt><i>pathName </i><b>:dtag </b><i>tagOrId </i><span class="roman">?tagToDelete</span>?</dt>
<dd><p>For each of the items given by <i>tagOrId</i>, delete the
tag given by <i>tagToDelete</i> from the list of those
associated with the item.
If an item doesn&rsquo;t have the tag <i>tagToDelete</i> then
the item is unaffected by the command.
If <i>tagToDelete</i><span class="roman"> is omitted then it defaults to </span><i>tagOrId</i>.
This command returns an empty string.
</p></dd>
<dt><i>pathName </i><b>:find </b><i>searchCommand </i><span class="roman">?</span><i>arg arg ...</i>?</dt>
<dd><p>This command returns a list consisting of all the items that
meet the constraints specified by <i>searchCommand</i> and
<i>arg</i>&rsquo;s.
<i>SearchCommand</i><span class="roman"> and </span><i>args</i> have any of the forms
accepted by the <b>addtag</b> command.
</p></dd>
<dt><i>pathName </i><b>:focus </b><span class="roman">?</span><i>tagOrId</i>?</dt>
<dd><p>Set the keyboard focus for the canvas widget to the item given by
<i>tagOrId</i>.
If <i>tagOrId</i> refers to several items, then the focus is set
to the first such item in the display list that supports the
insertion cursor.
If <i>tagOrId</i> doesn&rsquo;t refer to any items, or if none of them
support the insertion cursor, then the focus isn&rsquo;t changed.
If <i>tagOrId</i> is an empty
string, then the focus item is reset so that no item has the focus.
If <i>tagOrId</i> is not specified then the command returns the
id for the item that currently has the focus, or an empty string
if no item has the focus.
</p></dd>
</dl>


<p>Once the focus has been set to an item, the item will display
the insertion cursor and all keyboard events will be directed
to that item.
The focus item within a canvas and the focus window on the
screen (set with the <b>focus</b> command) are totally independent:
a given item doesn&rsquo;t actually have the input focus unless (a)
its canvas is the focus window and (b) the item is the focus item
within the canvas.
In most cases it is advisable to follow the <b>focus</b> widget
command with the <b>focus</b> command to set the focus window to
the canvas (if it wasn&rsquo;t there already).
</p>
<dl compact="compact">
<dt><i>pathName </i><b>:gettags</b><span class="roman"> </span><i>tagOrId</i></dt>
<dd><p>Return a list whose elements are the tags associated with the
item given by <i>tagOrId</i>.
If <i>tagOrId</i> refers to more than one item, then the tags
are returned from the first such item in the display list.
If <i>tagOrId</i> doesn&rsquo;t refer to any items, or if the item
contains no tags, then an empty string is returned.
</p></dd>
<dt><i>pathName </i><b>:icursor </b><i>tagOrId index</i></dt>
<dd><p>Set the position of the insertion cursor for the item(s)
given by <i>tagOrId</i>
to just before the character whose position is given by <i>index</i>.
If some or all of the items given by <i>tagOrId</i> don&rsquo;t support
an insertion cursor then this command has no effect on them.
See INDICES above for a description of the
legal forms for <i>index</i>.
Note:  the insertion cursor is only displayed in an item if
that item currently has the keyboard focus (see the widget
command <b>focus</b>, below), but the cursor position may
be set even when the item doesn&rsquo;t have the focus.
This command returns an empty string.
</p></dd>
<dt><i>pathName </i><b>:index </b><i>tagOrId index</i></dt>
<dd><p>This command returns a decimal string giving the numerical index
within <i>tagOrId</i><span class="roman"> corresponding to </span><i>index</i>.
<i>Index</i> gives a textual description of the desired position
as described in INDICES above.
The return value is guaranteed to lie between 0 and the number
of characters within the item, inclusive.
If <i>tagOrId</i> refers to multiple items, then the index
is processed in the first of these items that supports indexing
operations (in display list order).
</p></dd>
<dt><i>pathName </i><b>:insert </b><i>tagOrId beforeThis string</i></dt>
<dd><p>For each of the items given by <i>tagOrId</i>, if the item supports
text insertion then <i>string</i> is inserted into the item&rsquo;s
text just before the character whose index is <i>beforeThis</i>.
See INDICES above for information about the forms allowed
for <i>beforeThis</i>.
This command returns an empty string.
</p></dd>
<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>
<dd><p>This command is similar to the <b>configure</b> widget command except
that it modifies item-specific options for the items given by
<i>tagOrId</i> instead of modifying options for the overall
canvas widget.
If no <i>option</i> is specified, returns a list describing all of
the available options for the first item given by <i>tagOrId</i>
(see <b>Tk_ConfigureInfo</b> for
information on the format of this list).  If <i>option</i> is specified
with no <i>value</i>, then the command returns a list describing the
one named option (this list will be identical to the corresponding
sublist of the value returned if no <i>option</i> is specified).  If
one or more <i>option:value</i> pairs are specified, then the command
modifies the given widget option(s) to have the given value(s) in
each of the items given by <i>tagOrId</i>;  in
this case the command returns an empty string.
The <i>option</i><span class="roman">s and </span><i>value</i>s are the same as those permissible
in the <b>create</b> widget command when the item(s) were created;
see the sections describing individual item types below for details
on the legal options.
</p></dd>
<dt><i>pathName </i><b>:lower </b><i>tagOrId </i><span class="roman">?</span><i>belowThis</i>?</dt>
<dd><p>Move all of the items given by <i>tagOrId</i> to a new position
in the display list just before the item given by <i>belowThis</i>.
If <i>tagOrId</i> refers to more than one item then all are moved
but the relative order of the moved items will not be changed.
<i>BelowThis</i> is a tag or id;  if it refers to more than one
item then the first (lowest) of these items in the display list is used
as the destination location for the moved items.
This command returns an empty string.
</p></dd>
<dt><i>pathName </i><b>:move </b><i>tagOrId xAmount yAmount</i></dt>
<dd><p>Move each of the items given by <i>tagOrId</i> in the canvas coordinate
space by adding <i>xAmount</i> to the x-coordinate of each point
associated with the item and <i>yAmount</i> to the y-coordinate of
each point associated with the item.
This command returns an empty string.
</p></dd>
<dt><i>pathName </i><b>:postscript </b><span class="roman">?</span><i>option value option value ...</i>?</dt>
<dd><p>Generate a Postscript representation for part or all of the canvas.
If the <b>:file</b> option is specified then the Postscript is written
to a file and an empty string is returned;  otherwise the Postscript
is returned as the result of the command.
The Postscript is created in Encapsulated Postscript form using
version 3.0 of the Document Structuring Conventions.
The <i>option</i>\-<i>value</i> argument pairs provide additional
information to control the generation of Postscript.  The following
options are supported:
</p>
<dl compact="compact">
<dt><b>:colormap </b><i>varName</i></dt>
<dd><p><i>VarName</i> must be the name of a global array variable
that specifies a color mapping to use in the Postscript.
Each element of <i>varName</i> must consist of Postscript
code to set a particular color value (e.g. &ldquo;<b>1.0 1.0 0.0 setrgbcolor</b>&rdquo;).
When outputting color information in the Postscript, Tk checks
to see if there is an element of <i>varName</i> with the same
name as the color.
If so, Tk uses the value of the element as the Postscript command
to set the color.
If this option hasn&rsquo;t been specified, or if there isn&rsquo;t an entry
in <i>varName</i> for a given color, then Tk uses the red, green,
and blue intensities from the X color.
</p></dd>
<dt><b>:colormode </b><i>mode</i></dt>
<dd><p>Specifies how to output color information.  <i>Mode</i> must be either
<b>color</b><span class="roman"> (for full color output), </span><b>gray</b> (convert all colors
to their gray-scale equivalents) or <b>mono</b> (convert all colors
to black or white).
</p></dd>
<dt><b>:file </b><i>fileName</i></dt>
<dd><p>Specifies the name of the file in which to write the Postscript.
If this option isn&rsquo;t specified then the Postscript is returned as the
result of the command instead of being written to a file.
</p></dd>
<dt><b>:fontmap </b><i>varName</i></dt>
<dd><p><i>VarName</i> must be the name of a global array variable
that specifies a font mapping to use in the Postscript.
Each element of <i>varName</i> must consist of a Tcl list with
two elements, which are the name and point size of a Postscript font.
When outputting Postscript commands for a particular font, Tk
checks to see if <i>varName</i> contains an element with the same
name as the font.
If there is such an element, then the font information contained in
that element is used in the Postscript.
Otherwise Tk attempts to guess what Postscript font to use.
Tk&rsquo;s guesses generally only work for well-known fonts such as
Times and Helvetica and Courier, and only if the X font name does not
omit any dashes up through the point size.
For example, \fB\-*\-Courier\-Bold\-R\-Normal\-\-*\-120\-* will work but
\fB*Courier\-Bold\-R\-Normal*120* will not;  Tk needs the dashes to
parse the font name).
</p></dd>
<dt><b>:height </b><i>size</i></dt>
<dd><p>Specifies the height of the area of the canvas to print.
Defaults to the height of the canvas window.
</p></dd>
<dt><b>:pageanchor </b><i>anchor</i></dt>
<dd><p>Specifies which point of the printed area should be appear over
the positioning point on the page (which is given by the <b>:pagex</b>
and <b>:pagey</b> options).
For example, <b>:pageanchor n</b> means that the top center of the
printed area should be over the positioning point.
Defaults to <b>center</b>.
</p></dd>
<dt><b>:pageheight </b><i>size</i></dt>
<dd><p>Specifies that the Postscript should be scaled in both x and y so
that the printed area is <i>size</i> high on the Postscript page.
<i>Size</i> consists of a floating-point number followed by
<b>c</b><span class="roman"> for centimeters, </span><b>i</b><span class="roman"> for inches, </span><b>m</b> for millimeters,
or <b>p</b> or nothing for printer&rsquo;s points (1/72 inch).
Defaults to the height of the printed area on the screen.
If both <b>:pageheight</b><span class="roman"> and </span><b>:pagewidth</b> are specified then
the scale factor from the later option is used (non-uniform scaling
is not implemented).
</p></dd>
<dt><b>:pagewidth </b><i>size</i></dt>
<dd><p>Specifies that the Postscript should be scaled in both x and y so
that the printed area is <i>size</i> wide on the Postscript page.
<i>Size</i><span class="roman"> has the same form as for </span><b>:pageheight</b>.
Defaults to the width of the printed area on the screen.
If both <b>:pageheight</b><span class="roman"> and </span><b>:pagewidth</b> are specified then
the scale factor from the later option is used (non-uniform scaling
is not implemented).
</p></dd>
<dt><b>:pagex </b><i>position</i></dt>
<dd><p><i>Position</i> gives the x-coordinate of the positioning point on
the Postscript page, using any of the forms allowed for <b>:pageheight</b>.
Used in conjunction with the <b>:pagey</b><span class="roman"> and </span><b>:pageanchor</b> options
to determine where the printed area appears on the Postscript page.
Defaults to the center of the page.
</p></dd>
<dt><b>:pagey </b><i>position</i></dt>
<dd><p><i>Position</i> gives the y-coordinate of the positioning point on
the Postscript page, using any of the forms allowed for <b>:pageheight</b>.
Used in conjunction with the <b>:pagex</b><span class="roman"> and </span><b>:pageanchor</b> options
to determine where the printed area appears on the Postscript page.
Defaults to the center of the page.
</p></dd>
<dt><b>:rotate </b><i>boolean</i></dt>
<dd><p><i>Boolean</i> specifies whether the printed area is to be rotated 90
degrees.
In non-rotated output the x-axis of the printed area runs along
the short dimension of the page (&ldquo;portrait&rdquo; orientation);
in rotated output the x-axis runs along the long dimension of the
page (&ldquo;landscape&rdquo; orientation).
Defaults to non-rotated.
</p></dd>
<dt><b>:width </b><i>size</i></dt>
<dd><p>Specifies the width of the area of the canvas to print.
Defaults to the width of the canvas window.
</p></dd>
<dt><b>:x </b><i>position</i></dt>
<dd><p>Specifies the x-coordinate of the left edge of the area of the
canvas that is to be printed, in canvas coordinates, not window
coordinates.
Defaults to the coordinate of the left edge of the window.
</p></dd>
<dt><b>:y </b><i>position</i></dt>
<dd><p>Specifies the y-coordinate of the top edge of the area of the
canvas that is to be printed, in canvas coordinates, not window
coordinates.
Defaults to the coordinate of the top edge of the window.
</p></dd>
</dl>

</dd>
<dt><i>pathName </i><b>:raise </b><i>tagOrId </i><span class="roman">?</span><i>aboveThis</i>?</dt>
<dd><p>Move all of the items given by <i>tagOrId</i> to a new position
in the display list just after the item given by <i>aboveThis</i>.
If <i>tagOrId</i> refers to more than one item then all are moved
but the relative order of the moved items will not be changed.
<i>AboveThis</i> is a tag or id;  if it refers to more than one
item then the last (topmost) of these items in the display list is used
as the destination location for the moved items.
This command returns an empty string.
</p></dd>
<dt><i>pathName </i><b>:scale </b><i>tagOrId xOrigin yOrigin xScale yScale</i></dt>
<dd><p>Rescale all of the items given by <i>tagOrId</i> in canvas coordinate
space.
<i>XOrigin</i><span class="roman"> and </span><i>yOrigin</i> identify the origin for the scaling
operation and <i>xScale</i><span class="roman"> and </span><i>yScale</i> identify the scale
factors for x- and y-coordinates, respectively (a scale factor of
1.0 implies no change to that coordinate).
For each of the points defining each item, the x-coordinate is
adjusted to change the distance from <i>xOrigin</i> by a factor
of <i>xScale</i>.
Similarly, each y-coordinate is adjusted to change the distance
from <i>yOrigin</i><span class="roman"> by a factor of </span><i>yScale</i>.
This command returns an empty string.
</p></dd>
<dt><i>pathName </i><b>:scan</b><span class="roman"> </span><i>option args</i></dt>
<dd><p>This command is used to implement scanning on canvases.  It has
two forms, depending on <i>option</i>:
</p>
<dl compact="compact">
<dt><i>pathName </i><b>:scan :mark </b><i>x y</i></dt>
<dd><p>Records <i>x</i><span class="roman"> and </span><i>y</i> and the canvas&rsquo;s current view;  used
in conjunction with later <b>scan dragto</b> commands.
Typically this command is associated with a mouse button press in
the widget and <i>x</i><span class="roman"> and </span><i>y</i> are the coordinates of the
mouse.  It returns an empty string.
</p></dd>
<dt><i>pathName </i><b>:scan :dragto </b><i>x y</i>.</dt>
<dd><p>This command computes the difference between its <i>x</i><span class="roman"> and </span><i>y</i>
arguments (which are typically mouse coordinates) and the <i>x</i> and
<i>y</i><span class="roman"> arguments to the last </span><b>scan mark</b> command for the widget.
It then adjusts the view by 10 times the
difference in coordinates.  This command is typically associated
with mouse motion events in the widget, to produce the effect of
dragging the canvas at high speed through its window.  The return
value is an empty string.
</p></dd>
</dl>

</dd>
<dt><i>pathName </i><b>:select </b><i>option</i><span class="roman"> ?</span><i>tagOrId arg</i>?</dt>
<dd><p>Manipulates the selection in one of several ways, depending on
<i>option</i>.
The command may take any of the forms described below.
In all of the descriptions below, <i>tagOrId</i> must refer to
an item that supports indexing and selection;  if it refers to
multiple items then the first of
these that supports indexing and the selection is used.
<i>Index</i> gives a textual description of a position
within <i>tagOrId</i>, as described in INDICES above.
</p>
<dl compact="compact">
<dt><i>pathName </i><b>:select :adjust </b><i>tagOrId index</i></dt>
<dd><p>Locate the end of the selection in <i>tagOrId</i> nearest
to the character given by <i>index</i>, and adjust that
end of the selection to be at <i>index</i> (i.e. including
but not going beyond <i>index</i>).
The other end of the selection is made the anchor point
for future <b>select to</b> commands.
If the selection isn&rsquo;t currently in <i>tagOrId</i> then
this command behaves the same as the <b>select to</b> widget
command.
Returns an empty string.
</p></dd>
<dt><i>pathName </i><b>:select :clear</b></dt>
<dd><p>Clear the selection if it is in this widget.
If the selection isn&rsquo;t in this widget then the command
has no effect.
Returns an empty string.
</p></dd>
<dt><i>pathName </i><b>:select :from </b><i>tagOrId index</i></dt>
<dd><p>Set the selection anchor point for the widget to be just
before the character
given by <i>index</i><span class="roman"> in the item given by </span><i>tagOrId</i>.
This command doesn&rsquo;t change the selection;  it just sets
the fixed end of the selection for future <b>select to</b>
commands.
Returns an empty string.
</p></dd>
<dt><i>pathName </i><b>:select :item</b></dt>
<dd><p>Returns the id of the selected item, if the selection is in an
item in this canvas.
If the selection is not in this canvas then an empty string
is returned.
</p></dd>
<dt><i>pathName </i><b>:select :to </b><i>tagOrId index</i></dt>
<dd><p>Set the selection to consist of those characters of <i>tagOrId</i>
between the selection anchor point and
<i>index</i>.
The new selection will include the character given by <i>index</i>;
it will include the character given by the anchor point only if
<i>index</i> is greater than or equal to the anchor point.
The anchor point is determined by the most recent <b>select adjust</b>
or <b>select from</b> command for this widget.
If the selection anchor point for the widget isn&rsquo;t currently in
<i>tagOrId</i>, then it is set to the same character given
by <i>index</i>.
Returns an empty string.
</p></dd>
</dl>

</dd>
<dt><i>pathName </i><b>:type</b><i> tagOrId</i></dt>
<dd><p>Returns the type of the item given by <i>tagOrId</i>, such as
<b>rectangle</b><span class="roman"> or </span><b>text</b>.
If <i>tagOrId</i> refers to more than one item, then the type
of the first item in the display list is returned.
If <i>tagOrId</i> doesn&rsquo;t refer to any items at all then
an empty string is returned.
</p></dd>
<dt><i>pathName </i><b>:xview</b><i> index</i></dt>
<dd><p>Change the view in the canvas so that the canvas position given by
<i>index</i> appears at the left edge of the window.
This command is typically used by scrollbars to scroll the
canvas.
<i>Index</i> counts in units of scroll increments (the value of the
<b>scrollIncrement</b> option):  a value of 0 corresponds to the left
edge of the scroll region (as defined by the <b>scrollRegion</b>
option),  a value of 1 means one scroll unit to the right of this,
and so on.  The return value is an empty string.
</p></dd>
<dt><i>pathName </i><b>:yview</b><i> index</i></dt>
<dd><p>Change the view in the canvas so that the canvas position given by
<i>index</i> appears at the top edge of the window.
This command is typically used by scrollbars to scroll the
canvas.
<i>Index</i> counts in units of scroll increments (the value of the
<b>scrollIncrement</b> option):  a value of 0 corresponds to the top
edge of the scroll region (as defined by the <b>scrollRegion</b>
option),  a value of 1 means one scroll unit below this,
and so on.  The return value is an empty string.
</p>
</dd>
</dl>
<a name="Overview-Of-Item-Types"></a>
<h4 class="unnumberedsubsec">Overview Of Item Types</h4>

<p>The sections below describe the various types of items supported
by canvas widgets.  Each item type is characterized by two things:
first, the form of the <b>create</b> command used to create
instances of the type;  and second, a set of configuration options
for items of that type, which may be used in the
<b>create</b><span class="roman"> and </span><b>itemconfigure</b> widget commands.
Most items don&rsquo;t support indexing or selection or the commands
related to them, such as <b>index</b><span class="roman"> and </span><b>insert</b>.
Where items do support these facilities, it is noted explicitly
in the descriptions below (at present, only text items provide
this support).
</p>
<a name="Arc-Items"></a>
<h4 class="unnumberedsubsec">Arc Items</h4>

<p>Items of type <b>arc</b> appear on the display as arc-shaped regions.
An arc is a section of an oval delimited by two angles (specified
by the <b>:start</b><span class="roman"> and </span><b>:extent</b> options) and displayed in
one of several ways (specified by the <b>:style</b> option).
Arcs are created with widget commands of the following form:
</p>
<dl compact="compact">
<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>
<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
the coordinates of two diagonally opposite corners of a
rectangular region enclosing the oval that defines the arc.
After the coordinates there may be any number of <i>option</i><span class="roman">-</span><i>value</i>
pairs, each of which sets one of the configuration options
for the item.  These same <i>option</i>\-<i>value</i> pairs may be
used in <b>itemconfigure</b> widget commands to change the item&rsquo;s
configuration.
The following options are supported for arcs:
</p>
<dl compact="compact">
<dt><b>:extent </b><i>degrees</i></dt>
<dd><p>Specifies the size of the angular range occupied by the arc.
The arc&rsquo;s range extends for <i>degrees</i> degrees counter-clockwise
from the starting angle given by the <b>:start</b> option.
<i>Degrees</i> may be negative.
</p></dd>
<dt><b>:fill </b><i>color</i></dt>
<dd><p>Fill the region of the arc with <i>color</i>.
<i>Color</i><span class="roman"> may have any of the forms accepted by </span><b>Tk_GetColor</b>.
If <i>color</i> is an empty string (the default), then
then the arc will not be filled.
</p></dd>
<dt><b>:outline </b><i>color</i></dt>
<dd><p><i>Color</i> specifies a color to use for drawing the arc&rsquo;s
outline;  it may have any of the forms accepted by <b>Tk_GetColor</b>.
This option defaults to <b>black</b>.  If the arc&rsquo;s style is
<b>arc</b> then this option is ignored (the section of perimeter is
filled using the <b>:fill</b><span class="roman"> option).  If </span><i>color</i> is specified
as an empty string then no outline is drawn for the arc.
</p></dd>
<dt><b>:start </b><i>degrees</i></dt>
<dd><p>Specifies the beginning of the angular range occupied by the
arc.
<i>Degrees</i> is given in units of degrees measured counter-clockwise
from the 3-o&rsquo;clock position;  it may be either positive or negative.
</p></dd>
<dt><b>:stipple </b><i>bitmap</i></dt>
<dd><p>Indicates that the arc should be filled in a stipple pattern;
<i>bitmap</i> specifies the stipple pattern to use, in any of the
forms accepted by <b>Tk_GetBitmap</b>.
If the <b>:fill</b> option hasn&rsquo;t been specified then this option
has no effect.
If <i>bitmap</i> is an empty string (the default), then filling is done
in a solid fashion.
</p></dd>
<dt><b>:style </b><i>type</i></dt>
<dd><p>Specifies how to draw the arc.  If <i>type</i><span class="roman"> is </span><b>pieslice</b>
(the default) then the arc&rsquo;s region is defined by a section
of the oval&rsquo;s perimeter plus two line segments, one between the center
of the oval and each end of the perimeter section.
If <i>type</i><span class="roman"> is </span><b>chord</b> then the arc&rsquo;s region is defined
by a section of the oval&rsquo;s perimeter plus a single line segment
connecting the two end points of the perimeter section.
If <i>type</i><span class="roman"> is </span><b>arc</b> then the arc&rsquo;s region consists of
a section of the perimeter alone.  In this last case there is
no outline for the arc and the <b>:outline</b> option is ignored.
</p></dd>
<dt><b>:tags </b><i>tagList</i></dt>
<dd><p>Specifies a set of tags to apply to the item.
<i>TagList</i> consists of a list of tag names, which replace any
existing tags for the item.
<i>TagList</i> may be an empty list.
</p></dd>
<dt><b>:width </b><i>outlineWidth</i></dt>
<dd><p>Specifies the width of the outline to be drawn around
the arc&rsquo;s region, in any of the forms described in the COORDINATES
section above.
If the <b>:outline</b> option has been specified as an empty string
then this option has no effect.
Wide outlines will be drawn centered on the edges of the arc&rsquo;s region.
This option defaults to 1.0.
</p></dd>
</dl>
</dd>
</dl>

<a name="Bitmap-Items"></a>
<h4 class="unnumberedsubsec">Bitmap Items</h4>

<p>Items of type <b>bitmap</b> appear on the display as images with
two colors, foreground and background.
Bitmaps are created with widget commands of the following form:
</p>
<dl compact="compact">
<dt><i>pathName </i><b>:create bitmap </b><i>x y </i><span class="roman">?</span><i>option value option value ...</i>?</dt>
<dd><p>The arguments <i>x</i><span class="roman"> and </span><i>y</i> specify the coordinates of a
point used to position the bitmap on the display (see the <b>:anchor</b>
option below for more information on how bitmaps are displayed).
After the coordinates there may be any number of <i>option</i><span class="roman">-</span><i>value</i>
pairs, each of which sets one of the configuration options
for the item.  These same <i>option</i>\-<i>value</i> pairs may be
used in <b>itemconfigure</b> widget commands to change the item&rsquo;s
configuration.
The following options are supported for bitmaps:
</p>
<dl compact="compact">
<dt><b>:anchor </b><i>anchorPos</i></dt>
<dd><p><i>AnchorPos</i> tells how to position the bitmap relative to the
positioning point for the item;  it may have any of the forms
accepted by <b>Tk_GetAnchor</b><span class="roman">.  For example, if </span><i>anchorPos</i>
is <b>center</b> then the bitmap is centered on the point;  if
<i>anchorPos</i><span class="roman"> is </span><b>n</b> then the bitmap will be drawn so that
its top center point is at the positioning point.
This option defaults to <b>center</b>.
</p></dd>
<dt><b>:background </b><i>color</i></dt>
<dd><p>Specifies a color to use for each of the bitmap pixels
whose value is 0.
<i>Color</i><span class="roman"> may have any of the forms accepted by </span><b>Tk_GetColor</b>.
If this option isn&rsquo;t specified, or if it is specified as an empty
string, then the background color for the canvas is used.
</p></dd>
<dt><b>:bitmap </b><i>bitmap</i></dt>
<dd><p>Specifies the bitmap to display in the item.
<i>Bitmap</i><span class="roman"> may have any of the forms accepted by </span><b>Tk_GetBitmap</b>.
</p></dd>
<dt><b>:foreground </b><i>color</i></dt>
<dd><p>Specifies a color to use for each of the bitmap pixels
whose value is 1.
<i>Color</i><span class="roman"> may have any of the forms accepted by </span><b>Tk_GetColor</b> and
defaults to <b>black</b>.
</p></dd>
<dt><b>:tags </b><i>tagList</i></dt>
<dd><p>Specifies a set of tags to apply to the item.
<i>TagList</i> consists of a list of tag names, which replace any
existing tags for the item.
<i>TagList</i> may be an empty list.
</p></dd>
</dl>
</dd>
</dl>
<a name="Line-Items"></a>
<h4 class="unnumberedsubsec">Line Items</h4>

<p>Items of type <b>line</b> appear on the display as one or more connected
line segments or curves.
Lines are created with widget commands of the following form:
</p>
<dl compact="compact">
<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>
<dd>
<p>The arguments <i>x1</i><span class="roman"> through </span><i>yn</i> give
the coordinates for a series of two or more points that describe
a series of connected line segments.
After the coordinates there may be any number of <i>option</i><span class="roman">-</span><i>value</i>
pairs, each of which sets one of the configuration options
for the item.  These same <i>option</i>\-<i>value</i> pairs may be
used in <b>itemconfigure</b> widget commands to change the item&rsquo;s
configuration.
The following options are supported for lines:
</p>
<dl compact="compact">
<dt><b>:arrow </b><i>where</i></dt>
<dd><p>Indicates whether or not arrowheads are to be drawn at one or both
ends of the line.
<i>Where</i><span class="roman"> must have one of the values </span><b>none</b> (for no arrowheads),
<b>first</b> (for an arrowhead at the first point of the line),
<b>last</b> (for an arrowhead at the last point of the line), or
<b>both</b> (for arrowheads at both ends).
This option defaults to <b>none</b>.
</p></dd>
<dt><b>:arrowshape </b><i>shape</i></dt>
<dd><p>This option indicates how to draw arrowheads.
The <i>shape</i> argument must be a list with three elements, each
specifying a distance in any of the forms described in
the COORDINATES section above.
The first element of the list gives the distance along the line
from the neck of the arrowhead to its tip.
The second element gives the distance along the line from the
trailing points of the arrowhead to the tip, and the third
element gives the distance from the outside edge of the line to the
trailing points.
If this option isn&rsquo;t specified then Tk picks a &ldquo;reasonable&rdquo; shape.
</p></dd>
<dt><b>:capstyle </b><i>style</i></dt>
<dd><p>Specifies the ways in which caps are to be drawn at the endpoints
of the line.
<i>Style</i><span class="roman"> may have any of the forms accepted by </span><b>Tk_GetCapStyle</b>
(<b>butt</b><span class="roman">, </span><b>projecting</b><span class="roman">, or </span><b>round</b>).
If this option isn&rsquo;t specified then it defaults to <b>butt</b>.
Where arrowheads are drawn the cap style is ignored.
</p></dd>
<dt><b>:fill </b><i>color</i></dt>
<dd><p><i>Color</i> specifies a color to use for drawing the line; it may have
any of the forms acceptable to <b>Tk_GetColor</b>.  It may also be an
empty string, in which case the line will be transparent.
This option defaults to <b>black</b>.
</p></dd>
<dt><b>:joinstyle </b><i>style</i></dt>
<dd><p>Specifies the ways in which joints are to be drawn at the vertices
of the line.
<i>Style</i><span class="roman"> may have any of the forms accepted by </span><b>Tk_GetCapStyle</b>
(<b>bevel</b><span class="roman">, </span><b>miter</b><span class="roman">, or </span><b>round</b>).
If this option isn&rsquo;t specified then it defaults to <b>miter</b>.
If the line only contains two points then this option is
irrelevant.
</p></dd>
<dt><b>:smooth </b><i>boolean</i></dt>
<dd><p><i>Boolean</i><span class="roman"> must have one of the forms accepted by </span><b>Tk_GetBoolean</b>.
It indicates whether or not the line should be drawn as a curve.
If so, the line is rendered as a set of Bezier splines: one spline
is drawn for the first and second line segments, one for the second
and third, and so on.  Straight-line segments can be generated within
a curve by duplicating the end-points of the desired line segment.
</p></dd>
<dt><b>:splinesteps </b><i>number</i></dt>
<dd><p>Specifies the degree of smoothness desired for curves:  each spline
will be approximated with <i>number</i> line segments.  This
option is ignored unless the <b>:smooth</b> option is true.
</p></dd>
<dt><b>:stipple </b><i>bitmap</i></dt>
<dd><p>Indicates that the line should be filled in a stipple pattern;
<i>bitmap</i> specifies the stipple pattern to use, in any of the
forms accepted by <b>Tk_GetBitmap</b>.
If <i>bitmap</i> is an empty string (the default), then filling is
done in a solid fashion.
</p></dd>
<dt><b>:tags </b><i>tagList</i></dt>
<dd><p>Specifies a set of tags to apply to the item.
<i>TagList</i> consists of a list of tag names, which replace any
existing tags for the item.
<i>TagList</i> may be an empty list.
</p></dd>
<dt><b>:width </b><i>lineWidth</i></dt>
<dd><p><i>LineWidth</i> specifies the width of the line, in any of the forms
described in the COORDINATES section above.
Wide lines will be drawn centered on the path specified by the
points.
If this option isn&rsquo;t specified then it defaults to 1.0.
</p></dd>
</dl>
</dd>
</dl>
<a name="Oval-Items"></a>
<h4 class="unnumberedsubsec">Oval Items</h4>

<p>Items of type <b>oval</b> appear as circular or oval regions on
the display.  Each oval may have an outline, a fill, or
both.  Ovals are created with widget commands of the
following form:
</p>
<dl compact="compact">
<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>
<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
the coordinates of two diagonally opposite corners of a
rectangular region enclosing the oval.
The oval will include the top and left edges of the rectangle
not the lower or right edges.
If the region is square then the resulting oval is circular;
otherwise it is elongated in shape.
After the coordinates there may be any number of <i>option</i><span class="roman">-</span><i>value</i>
pairs, each of which sets one of the configuration options
for the item.  These same <i>option</i>\-<i>value</i> pairs may be
used in <b>itemconfigure</b> widget commands to change the item&rsquo;s
configuration.
The following options are supported for ovals:
</p>
<dl compact="compact">
<dt><b>:fill </b><i>color</i></dt>
<dd><p>Fill the area of the oval with <i>color</i>.
<i>Color</i><span class="roman"> may have any of the forms accepted by </span><b>Tk_GetColor</b>.
If <i>color</i> is an empty string (the default), then
then the oval will not be filled.
</p></dd>
<dt><b>:outline </b><i>color</i></dt>
<dd><p><i>Color</i> specifies a color to use for drawing the oval&rsquo;s
outline;  it may have any of the forms accepted by <b>Tk_GetColor</b>.
This option defaults to <b>black</b>.
If <i>color</i> is an empty string then no outline will be
drawn for the oval.
</p></dd>
<dt><b>:stipple </b><i>bitmap</i></dt>
<dd><p>Indicates that the oval should be filled in a stipple pattern;
<i>bitmap</i> specifies the stipple pattern to use, in any of the
forms accepted by <b>Tk_GetBitmap</b>.
If the <b>:fill</b> option hasn&rsquo;t been specified then this option
has no effect.
If <i>bitmap</i> is an empty string (the default), then filling is done
in a solid fashion.
</p></dd>
<dt><b>:tags </b><i>tagList</i></dt>
<dd><p>Specifies a set of tags to apply to the item.
<i>TagList</i> consists of a list of tag names, which replace any
existing tags for the item.
<i>TagList</i> may be an empty list.
</p></dd>
<dt><b>:width </b><i>outlineWidth</i></dt>
<dd><p><i>outlineWidth</i> specifies the width of the outline to be drawn around
the oval, in any of the forms described in the COORDINATES section above.
If the <b>:outline</b> option hasn&rsquo;t been specified then this option
has no effect.
Wide outlines are drawn centered on the oval path 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>.
This option defaults to 1.0.
</p></dd>
</dl>
</dd>
</dl>
<a name="Polygon-Items"></a>
<h4 class="unnumberedsubsec">Polygon Items</h4>

<p>Items of type <b>polygon</b> appear as polygonal or curved filled regions
on the display.
Polygons are created with widget commands of the following form:
</p>
<dl compact="compact">
<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>
<dd>

<p>The arguments <i>x1</i><span class="roman"> through </span><i>yn</i> specify the coordinates for
three or more points that define a closed polygon.
The first and last points may be the same;  whether they are or not,
Tk will draw the polygon as a closed polygon.
After the coordinates there may be any number of <i>option</i><span class="roman">-</span><i>value</i>
pairs, each of which sets one of the configuration options
for the item.  These same <i>option</i>\-<i>value</i> pairs may be
used in <b>itemconfigure</b> widget commands to change the item&rsquo;s
configuration.
The following options are supported for polygons:
</p>
<dl compact="compact">
<dt><b>:fill </b><i>color</i></dt>
<dd><p><i>Color</i> specifies a color to use for filling the area of the
polygon; it may have any of the forms acceptable to <b>Tk_GetColor</b>.
If <i>color</i> is an empty string then the polygon will be
transparent.
This option defaults to <b>black</b>.
</p></dd>
<dt><b>:smooth </b><i>boolean</i></dt>
<dd><p><i>Boolean</i><span class="roman"> must have one of the forms accepted by </span><b>Tk_GetBoolean</b>
It indicates whether or not the polygon should be drawn with a
curved perimeter.
If so, the outline of the polygon becomes a set of Bezier splines,
one spline for the first and second line segments, one for the second
and third, and so on.  Straight-line segments can be generated in a
smoothed polygon by duplicating the end-points of the desired line segment.
</p></dd>
<dt><b>:splinesteps </b><i>number</i></dt>
<dd><p>Specifies the degree of smoothness desired for curves:  each spline
will be approximated with <i>number</i> line segments.  This
option is ignored unless the <b>:smooth</b> option is true.
</p></dd>
<dt><b>:stipple </b><i>bitmap</i></dt>
<dd><p>Indicates that the polygon should be filled in a stipple pattern;
<i>bitmap</i> specifies the stipple pattern to use, in any of the
forms accepted by <b>Tk_GetBitmap</b>.
If <i>bitmap</i> is an empty string (the default), then filling is
done in a solid fashion.
</p></dd>
<dt><b>:tags </b><i>tagList</i></dt>
<dd><p>Specifies a set of tags to apply to the item.
<i>TagList</i> consists of a list of tag names, which replace any
existing tags for the item.
<i>TagList</i> may be an empty list.
</p></dd>
</dl>
</dd>
</dl>

<a name="Rectangle-Items"></a>
<h4 class="unnumberedsubsec">Rectangle Items</h4>

<p>Items of type <b>rectangle</b> appear as rectangular regions on
the display.  Each rectangle may have an outline, a fill, or
both.  Rectangles are created with widget commands of the
following form:
</p>
<dl compact="compact">
<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>
<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
the coordinates of two diagonally opposite corners of the rectangle
(the rectangle will include its upper and left edges but not
its lower or right edges).
After the coordinates there may be any number of <i>option</i><span class="roman">-</span><i>value</i>
pairs, each of which sets one of the configuration options
for the item.  These same <i>option</i>\-<i>value</i> pairs may be
used in <b>itemconfigure</b> widget commands to change the item&rsquo;s
configuration.
The following options are supported for rectangles:
</p>
<dl compact="compact">
<dt><b>:fill </b><i>color</i></dt>
<dd><p>Fill the area of the rectangle with <i>color</i>, which may be
specified in any of the forms accepted by <b>Tk_GetColor</b>.
If <i>color</i> is an empty string (the default), then
then the rectangle will not be filled.
</p></dd>
<dt><b>:outline </b><i>color</i></dt>
<dd><p>Draw an outline around the edge of the rectangle in <i>color</i>.
<i>Color</i><span class="roman"> may have any of the forms accepted by </span><b>Tk_GetColor</b>.
This option defaults to <b>black</b>.
If <i>color</i> is an empty string then no outline will be
drawn for the rectangle.
</p></dd>
<dt><b>:stipple </b><i>bitmap</i></dt>
<dd><p>Indicates that the rectangle should be filled in a stipple pattern;
<i>bitmap</i> specifies the stipple pattern to use, in any of the
forms accepted by <b>Tk_GetBitmap</b>.
If the <b>:fill</b> option hasn&rsquo;t been specified then this option
has no effect.
If <i>bitmap</i> is an empty string (the default), then filling
is done in a solid fashion.
</p></dd>
<dt><b>:tags </b><i>tagList</i></dt>
<dd><p>Specifies a set of tags to apply to the item.
<i>TagList</i> consists of a list of tag names, which replace any
existing tags for the item.
<i>TagList</i> may be an empty list.
</p></dd>
<dt><b>:width </b><i>outlineWidth</i></dt>
<dd><p><i>OutlineWidth</i> specifies the width of the outline to be drawn around
the rectangle, in any of the forms described in the COORDINATES section above.
If the <b>:outline</b> option hasn&rsquo;t been specified then this option
has no effect.
Wide outlines are drawn centered on the rectangular path
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>.
This option defaults to 1.0.
</p></dd>
</dl>
</dd>
</dl>
<a name="Text-Items"></a>
<h4 class="unnumberedsubsec">Text Items</h4>

<p>A text item displays a string of characters on the screen in one
or more lines.
Text items support indexing and selection, along with the
following text-related canvas widget commands:  <b>dchars</b>,
<b>focus</b><span class="roman">, </span><b>icursor</b><span class="roman">, </span><b>index</b><span class="roman">, </span><b>insert</b>,
<b>select</b>.
Text items are created with widget commands of the following
form:
</p>
<dl compact="compact">
<dt><i>pathName </i><b>:create text </b><i>x y </i><span class="roman">?</span><i>option value option value ...</i>?</dt>
<dd>
<p>The arguments <i>x</i><span class="roman"> and </span><i>y</i> specify the coordinates of a
point used to position the text on the display (see the options
below for more information on how text is displayed).
After the coordinates there may be any number of <i>option</i><span class="roman">-</span><i>value</i>
pairs, each of which sets one of the configuration options
for the item.  These same <i>option</i>\-<i>value</i> pairs may be
used in <b>itemconfigure</b> widget commands to change the item&rsquo;s
configuration.
The following options are supported for text items:
</p>
<dl compact="compact">
<dt><b>:anchor </b><i>anchorPos</i></dt>
<dd><p><i>AnchorPos</i> tells how to position the text relative to the
positioning point for the text;  it may have any of the forms
accepted by <b>Tk_GetAnchor</b><span class="roman">.  For example, if </span><i>anchorPos</i>
is <b>center</b> then the text is centered on the point;  if
<i>anchorPos</i><span class="roman"> is </span><b>n</b> then the text will be drawn such that
the top center point of the rectangular region occupied by the
text will be at the positioning point.
This option defaults to <b>center</b>.
</p></dd>
<dt><b>:fill </b><i>color</i></dt>
<dd><p><i>Color</i> specifies a color to use for filling the text characters;
it may have any of the forms accepted by <b>Tk_GetColor</b>.
If this option isn&rsquo;t specified then it defaults to <b>black</b>.
</p></dd>
<dt><b>:font </b><i>fontName</i></dt>
<dd><p>Specifies the font to use for the text item.
<i>FontName</i><span class="roman"> may be any string acceptable to </span><b>Tk_GetFontStruct</b>.
If this option isn&rsquo;t specified, it defaults to a system-dependent
font.
</p></dd>
<dt><b>:justify </b><i>how</i></dt>
<dd><p>Specifies how to justify the text within its bounding region.
<i>How</i><span class="roman"> must be one of the values </span><b>left</b><span class="roman">, </span><b>right</b>,
or <b>center</b>.
This option will only matter if the text is displayed as multiple
lines.
If the option is omitted, it defaults to <b>left</b>.
</p></dd>
<dt><b>:stipple </b><i>bitmap</i></dt>
<dd><p>Indicates that the text should be drawn in a stippled pattern
rather than solid;
<i>bitmap</i> specifies the stipple pattern to use, in any of the
forms accepted by <b>Tk_GetBitmap</b>.
If <i>bitmap</i> is an empty string (the default) then the text
is drawn in a solid fashion.
</p></dd>
<dt><b>:tags </b><i>tagList</i></dt>
<dd><p>Specifies a set of tags to apply to the item.
<i>TagList</i> consists of a list of tag names, which replace any
existing tags for the item.
<i>TagList</i> may be an empty list.
</p></dd>
<dt><b>:text </b><i>string</i></dt>
<dd><p><i>String</i> specifies the characters to be displayed in the text item.
Newline characters cause line breaks.
The characters in the item may also be changed with the
<b>insert</b><span class="roman"> and </span><b>delete</b> widget commands.
This option defaults to an empty string.
</p></dd>
<dt><b>:width </b><i>lineLength</i></dt>
<dd><p>Specifies a maximum line length for the text, in any of the forms
described in the COORDINATES section abov.
If this option is zero (the default) the text is broken into
lines only at newline characters.
However, if this option is non-zero then any line that would
be longer than <i>lineLength</i> is broken just before a space
character to make the line shorter than <i>lineLength</i>;  the
space character is treated as if it were a newline
character.
</p>
</dd>
</dl>
</dd>
</dl>
<a name="Window-Items"></a>
<h4 class="unnumberedsubsec">Window Items</h4>

<p>Items of type <b>window</b> cause a particular window to be displayed
at a given position on the canvas.
Window items are created with widget commands of the following form:
</p>
<div class="example">
<pre class="example"><i>pathName </i><b>:create window </b><i>x y </i><span class="roman">?</span><i>option value option value ...</i>?
</pre></div>

<p>The arguments <i>x</i><span class="roman"> and </span><i>y</i> specify the coordinates of a
point used to position the window on the display (see the <b>:anchor</b>
option below for more information on how bitmaps are displayed).
After the coordinates there may be any number of <i>option</i><span class="roman">-</span><i>value</i>
pairs, each of which sets one of the configuration options
for the item.  These same <i>option</i>\-<i>value</i> pairs may be
used in <b>itemconfigure</b> widget commands to change the item&rsquo;s
configuration.
The following options are supported for window items:
</p>
<dl compact="compact">
<dt><b>:anchor </b><i>anchorPos</i></dt>
<dd><p><i>AnchorPos</i> tells how to position the window relative to the
positioning point for the item;  it may have any of the forms
accepted by <b>Tk_GetAnchor</b><span class="roman">.  For example, if </span><i>anchorPos</i>
is <b>center</b> then the window is centered on the point;  if
<i>anchorPos</i><span class="roman"> is </span><b>n</b> then the window will be drawn so that
its top center point is at the positioning point.
This option defaults to <b>center</b>.
</p></dd>
<dt><b>:height </b><i>pixels</i></dt>
<dd><p>Specifies the height to assign to the item&rsquo;s window.
<i>Pixels</i> may have any of the
forms described in the COORDINATES section above.
If this option isn&rsquo;t specified, or if it is specified as an empty
string, then the window is given whatever height it requests internally.
</p></dd>
<dt><b>:tags </b><i>tagList</i></dt>
<dd><p>Specifies a set of tags to apply to the item.
<i>TagList</i> consists of a list of tag names, which replace any
existing tags for the item.
<i>TagList</i> may be an empty list.
</p></dd>
<dt><b>:width </b><i>pixels</i></dt>
<dd><p>Specifies the width to assign to the item&rsquo;s window.
<i>Pixels</i> may have any of the
forms described in the COORDINATES section above.
If this option isn&rsquo;t specified, or if it is specified as an empty
string, then the window is given whatever width it requests internally.
</p></dd>
<dt><b>:window </b><i>pathName</i></dt>
<dd><p>Specifies the window to associate with this item.
The window specified by <i>pathName</i> must either be a child of
the canvas widget or a child of some ancestor of the canvas widget.
<i>PathName</i> may not refer to a top-level window.
</p>
</dd>
</dl>
<a name="Application_002dDefined-Item-Types"></a>
<h4 class="unnumberedsubsec">Application-Defined Item Types</h4>

<p>It is possible for individual applications to define new item
types for canvas widgets using C code.
The interfaces for this mechanism are not presently documented,
and it&rsquo;s possible they may change, but you should be able to
see how they work by examining the code for some of the existing
item types.
</p>
<a name="Bindings-1"></a>
<h4 class="unnumberedsubsec">Bindings</h4>

<p>In the current implementation, new canvases are not given any
default behavior:  you&rsquo;ll have to execute explicit Tcl commands
to give the canvas its behavior.
</p>
<a name="Credits"></a>
<h4 class="unnumberedsubsec">Credits</h4>

<p>Tk&rsquo;s canvas widget is a blatant ripoff of ideas from Joel Bartlett&rsquo;s
<i>ezd</i><span class="roman"> program.  </span><i>Ezd</i> provides structured graphics in a Scheme
environment and preceded canvases by a year or two.  Its simple
mechanisms for placing and animating graphical objects inspired the
functions of canvases.
</p>
<a name="Keywords-3"></a>
<h4 class="unnumberedsubsec">Keywords</h4>
<p>canvas, widget
</p><hr>
<div class="header">
<p>
Next: <a href="menu.html#menu" accesskey="n" rel="next">menu</a>, Previous: <a href="scale.html#scale" accesskey="p" rel="prev">scale</a>, Up: <a href="Widgets.html#Widgets" accesskey="u" rel="up">Widgets</a> &nbsp; [<a href="wm.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>]</p>
</div>



</body>
</html>