Circle objects are created using the following functions. Circles are drawn specifying their center point (x, y), and their radius.
Function | Description |
Circle(x, y, radius) | Creates a circle at the given x, y coordinates, and radius. |
Circle(x, y, radius, color, filled, thickness) | Creates a circle at the given x, y coordinates, radius, color (e.g. Color.BLACK (default), Color.ORANGE or Color(255, 0, 255), using specific RGB values), filled (boolean – default is False), and thickness (default is 1 pixel). |
Once a Circle has been created, it may be added to a Display specifying where to place its center point.
circle1 = Circle(50, 50, 5) d.add(circle1)
Finally, you may use the following functions:
Function | Description |
circle1.setColor(color) | Changes color to the specified color (e.g. Color.BLACK or Color(255, 0, 255), using specific RGB values). If the color parameter is omitted, a color selection dialog box will be presented. |
circle1.getColor() | Returns the current color. |
circle1.getX() | Returns the x coordinate (in pixels). |
circle1.getY() | Returns the y coordinate (in pixels). |
circle1.setX(x) | Sets the x coordinate (in pixels). |
circle1.setY(y) | Sets the y coordinate (in pixels). |
circle1.encloses(other) | Returns True if circle1 encloses other graphics object. |
circle1.intersects(other) | Returns True if circle1 intersects other graphics object. |
circle1.getPosition() | Returns the position as an (x, y) tuple. |
circle1.setPosition(x, y) | Sets the position to x, y. |