Point objects are created using the following functions. Points are drawn specifying their center point (x, y).
Function | Description |
Point(x, y) | Creates a new Point at the given x, y coordinates. |
Point(x, y, color) | Creates a new Point at the given x, y coordinates, and color (e.g. Color.BLACK (default), Color.ORANGE or Color(255, 0, 255), using specific RGB values). |
Once a Point has been created, it may be added to a Display specifying where to place its center point.
point1 = Point(50, 50) d.add(point1)
Finally, you may use the following functions:
Function | Description |
point1.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. |
point1.getColor() | Returns the current color. |
point1.getX() | Returns the x coordinate (in pixels). |
point1.getY() | Returns the y coordinate (in pixels). |
point1.setX(x) | Sets the x coordinate (in pixels). |
point1.setY(y) | Sets the y coordinate (in pixels). |
point1.encloses(other) | Returns True if point1 encloses other graphics object (in reality, the other object can only possibly be another point). |
point1.intersects(other) | Returns True if point1 intersects other graphics object. |
point1.getPosition() | Returns the position as an (x, y) tuple. |
point1.setPosition(x, y) | Sets the position to x, y. |