Arc objects are created using the following functions. An Arc is drawn inside an invisible rectangle by specifying the top-left corner point (x1, y1), the bottom-right corner point (x2, y2), the start angle, and the end angle in degrees.
Function | Description |
Arc(x1, y1, x2, y2, startAngle, endAngle) | Creates an Arc with top-left corner at x1, y1, bottom-right corner at x2, y2, startAngle (in degrees), endAngle (in degrees). Drawing always occurs in the direction of the unit circle (i.e., counter-clockwise), for positive angles. If one or both of the angles are negative, then drawing occurs in the opposite direction of the unit circle (i.e., clockwise). |
Arc(x1, y1, x2, y2, startAngle, endAngle, color, fill, thickness) | Same as above, plus color (e.g. Color.BLACK (default), Color.ORANGE or Color(255, 0, 255), using specific RGB values), fill (boolean – default is False), and thickness (default is 1 (pixel)). |
Once an Arc has been created, it may be added to a Display.
arc1 = Arc(100, 100, 200, 200, 0, 180) d.add(arc1)
Finally, you may use the following functions:
Function | Description |
arc1.encloses(other) | Returns True if arc1 encloses other graphics object. |
arc1.intersects(other) | Returns True if arc1 intersects other graphics object. |
arc1.getX() | Returns the x coordinate (in pixels). |
arc1.getY() | Returns the y coordinate (in pixels). |
arc1.setX(x) | Sets the x coordinate (in pixels). |
arc1.setY(y) | Sets the y coordinate (in pixels). |
arc1.getPosition() | Returns the position as an (x, y) tuple. This is the top-left corner of the box that encloses the arc. |
arc1.setPosition(x, y) | Sets the position to x, y. This is the top-left corner of the box that encloses the arc. |