Oval objects are created using the following functions. Ovals are drawn by specifying the top-left corner point (x1, y1) and the bottom-right corner point (x2, y2) of the box that encloses them.
Function | Description |
Oval(x1, y1, x2, y2) | Creates an Oval with top-left corner at x1, y1, and bottom-right corner at x2, y2. |
Oval(x1, y1, x2, y2, color, filled, thickness) | Creates an Oval with top-left corner at x1, y1, bottom-right corner at x2, y2, 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 Oval has been created, it may be added to a Display.
oval1 = Oval(50, 30, 100, 150) d.add(oval1)
Finally, you may use the following functions:
Function | Description |
oval1.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. |
oval1.getColor() | Returns the current color. |
oval1.getX() | Returns the x coordinate (in pixels). |
oval1.getY() | Returns the y coordinate (in pixels). |
oval1.setX(x) | Sets the x coordinate (in pixels). |
oval1.setY(y) | Sets the y coordinate (in pixels). |
oval1.encloses(other) | Returns True if oval1 encloses other graphics object. |
oval1.intersects(other) | Returns True if oval1 intersects other graphics object. |
oval1.getPosition() | Returns the position as an (x, y) tuple. This is the top-left corner of the box that encloses the oval. |
oval1.setPosition(x, y) | Sets the position to x, y. This is the top-left corner of the box that encloses the oval. |