Quad
- class Quad(p1, p2, p3, p4)
An object representing a quad with 4 vertices.
- Parameters
p1 – a tuple
(x, y)
with the 1st coordinate in world spacep2 – a tuple
(x, y)
with the 2nd coordinate in world spacep3 – a tuple
(x, y)
with the 3rd coordinate in world spacep4 – a tuple
(x, y)
with the 4th coordinate in world space
- Raises
TypeError – p1, p2, p3, and p4 must be
(x, y)
tuples of numbers
- set_color(*args) None
Sets the fill color of the object
- Parameters
*args – a color or 4 colors corresponding to each vertex
- Raises
TypeError – arguments must be colors
- Return type
None
- set_transparency(*args: float) None
Sets the transparency of the object
- Parameters
*args (
float
) – a float or 4 floats corresponding to bottom-left, bottom-right, top-right, and top-left- Raises
TypeError – arguments must be floats
ValueError – transparency must be between 0 and 1
- Return type
None
- class Rectangle(p1: tuple[float, float], *args: Union[tuple[float, float], float])
An object representing a rectangle
- Parameters
p1 – a tuple
(x, y)
in world space*args – either annother tuple
(x, y)
in world space, or the width and height of the rectangle
- Raises
TypeError – arguments must be numbers or coordinates
Examples
# Creates a rectangle centered at (50, 100) with a size of (100, 200) >>> Rectangle((0, 0), (100, 200)) # Creates a rectangle centered at (0, 0) with size (50, 100) >>> Rectangle((0, 0), 50, 100)