Tk - Canvas Oval Widget


Advertisements

Oval widget is used to draw an oval shape in canvas. The syntax for oval widget is shown below −

canvasName create oval x1 y1 x2 y2 options

x1 y1 and x2 y2 are the end points of oval.

Options

The options available for the oval widget are listed below in the following table −

Sr.No. Syntax & Description
1

-outline color

Determines the outline color.

2

-fill color

The fill color fills the oval with the color.

3

-stipple bitmap

The stipple pattern to use if the -fill option is being used.

4

-width number

Determines the width.

A simple example for oval widget is shown below −

#!/usr/bin/wish

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

When we run the above program, we will get the following output −

Canvas Oval Example
tk_canvas_widgets.htm
Advertisements