pythonware.com products ::: library ::: search ::: daily Python-URL!
   

The Canvas Arc Item

Back   Next   

 Chapter 14. The Canvas Arc Item

Table of Contents
Methods
Options

An arc item is a section of oval, delimited by two angles (start and extent). An arc item can be drawn in one of three ways:

  • pieslice (lines are drawn from the perimeter to the oval's center)

  • chord (the ends are connected with a straight line)

  • arc (only the perimeter section is drawn)

    xy = 20, 20, 300, 180
    canvas.create_arc(xy, start=0, extent=270, fill="red")
    canvas.create_arc(xy, start=270, extent=60, fill="blue")
    canvas.create_arc(xy, start=330, extent=30, fill="green")

Pieslices and chords can be filled.

Figure 14-1. Pieslice Example

 Methods

The following methods are used to create and configure arc items:

create_arc(x0, y0, x1, y1, options...) => id, create_arc(box, options...) => id

Create a arc item enclosed by the given rectangle. The start and extent options control which section to draw. If they are set to 0.0 and 360.0, a full oval is drawn which touches the rectangle's four edges.

delete(item)

Delete an arc item.

coords(item, x0, y0, x1, y1)

Change the enclosing rectangle for one or more arc items.

itemconfigure(item, options...)

Change the options for one or more arc items.

Back   Next