Tk - 畫布橢圓部件



橢圓部件用於在畫布上繪製橢圓形狀。橢圓部件的語法如下所示:

canvasName create oval x1 y1 x2 y2 options

x1 y1 和 x2 y2 是橢圓的端點。

選項

橢圓部件可用的選項在下面的表格中列出:

序號 語法和描述
1

-outline color

確定輪廓顏色。

2

-fill color

填充顏色用顏色填充橢圓。

3

-stipple bitmap

如果使用 -fill 選項,則使用該點陣圖案。

4

-width number

確定寬度。

橢圓部件的一個簡單示例如下所示:

#!/usr/bin/wish

canvas .myCanvas -background red -width 200 -height 200 
pack .myCanvas
.myCanvas create oval 50 50 100 80 -fill yellow

執行以上程式後,將得到以下輸出:

Canvas Oval Example
tk_canvas_widgets.htm
廣告

© . All rights reserved.