pack [canvas .c -width 100 -height 100 -bg blue] .c create arc 20 20 80 80 -start 0 -extent 270 -fill yellow .c create arc 20 20 80 80 -start 270 -extent 90 -fill red |
pack [canvas .c -width 100 -height 100 -bg blue] .c create bitmap 30 30 -bitmap questhead -foreground red .c create bitmap 70 70 -bitmap hourglass -foreground yellow |
image create photo foo -file tori.gif pack [canvas .c -width 120 -height 100 -bg blue] .c create image 5 50 -image foo -anchor w |
pack [canvas .c -width 100 -height 100 -bg blue] .c create line 20 15 60 55 -fill red -arrow first .c create line 50 15 90 55 -fill green -arrow last .c create line 35 50 75 90 -fill yellow -arrow both |
pack [canvas .c -width 100 -height 100 -bg blue] .c create oval 20 15 60 55 -fill red .c create oval 50 15 90 55 -fill green .c create oval 35 50 75 90 -fill yellow |
pack [canvas .c -width 100 -height 100 -bg pink] .c create polygon 50 27 37 16 17 22 10 50 50 85 50 85 \ 90 50 82 22 62 16 50 27 50 27 -smooth true -splinesteps 5 -fill red |
pack [canvas .c -width 100 -height 100 -bg blue] .c create rectangle 20 20 80 80 -fill yellow .c create rectangle 40 40 60 60 -fill red |
pack [canvas .c -width 100 -height 100 -bg blue] .c create text 30 30 -text Hello -anchor w -fill white .c create text 30 60 -text World! -anchor w -fill yellow |
pack [canvas .c -width 100 -height 100 -bg blue] button .c.b -text Push -width 5 entry .c.e -width 6 .c create window 20 30 -window .c.b -anchor w .c create window 20 60 -window .c.e -anchor w |
| -dash pattern | 点線のパタンを指定します。 |
| -activedash pattern | 点線のパタンを指定します。 |
| -disableddash pattern | 点線のパタンを指定します。 |
| -dashoffset offset | dashの開始オフセットを指定します。 |
| -fill color | 図形の色を指定します。 |
| -activefill color | 図形の色を指定します。 |
| -disabledfill color | 図形の色を指定します。 |
| -outline color | 輪郭線の色を指定します。 |
| -activeoutline color | 輪郭線の色を指定します。 |
| -disabledoutline color | 輪郭線の色を指定します。 |
| -offset offset | stippleのオフセットを指定します。 |
| -outlinestipple bitmap | outlineにビットマップを指定します。 |
| -activeoutlinestipple bitmap | outlineにビットマップを指定します。 |
| -disabledoutlinestipple bitmap | outlineにビットマップを指定します。 |
| -stipple bitmap | fillにビットマップを指定します。 |
| -activestipple bitmap | fillにビットマップを指定します。 |
| -disabledstipple bitmap | fillにビットマップを指定します。 |
| -state state | 状態を指定します。(normal, disabled, hiddenのいずれか) |
| -tags tagList | アイテムにタグ名を付けます。 |
| -width outlineWidth | 輪郭線の太さを指定します。 |
| -activewidth outlineWidth | 輪郭線の太さを指定します。 |
| -disabledwidth outlineWidth | 輪郭線の太さを指定します。 |
次の例は、キャンバスWidget内の図形にタグ名を付けて、
その図形の輪郭線の色を変更するバインドをしています。
pack [canvas .c -height 70 -width 70 -bg white]
.c create oval 10 10 40 40 -fill red -width 4 -tag foo
.c create oval 30 10 60 40 -fill green -width 4 -tag foo
.c create oval 20 30 50 60 -fill blue -width 4 -tag foo
.c bind foo <Enter> {
%W itemconfigure foo -outline gold
}
.c bind foo <Leave> {
%W itemconfigure foo -outline black
}
|
タグ名を付けるときの注意として、キャンバスWidgetでは、
allという名前のタグ名はすべてのタグを指すために予約されているという点です。
.c postscript -file foo.ps |