psychos.visual.Circle#
- class psychos.visual.Circle(position: Tuple[float, float] = (0, 0), radius: float | None = None, color: ColorType | None = None, window: Window | None = None, coordinates: UnitType | Unit | None = None, **kwargs)[source]#
Bases:
CircleA circle shape that can be drawn on the screen.
- Parameters:
position (Tuple[float, float], default=(0, 0)) – The position of the circle in the window.
radius (Optional[float], default=None) – The radius of the circle, in the units of the window or the given coordinates.
color (Optional[ColorType], default=None) – The color of the circle.
window (Optional[Window], default=None) – The window in which the circle will be displayed.
coordinates (Optional[Union[UnitType, Unit]], default=None) – The unit system to be used for positioning the circle.
kwargs (dict) – Additional keyword arguments to pass to the Pyglet Circle.
- __init__(position: Tuple[float, float] = (0, 0), radius: float | None = None, color: ColorType | None = None, window: Window | None = None, coordinates: UnitType | Unit | None = None, **kwargs)[source]#
Create a circle.
The circle’s anchor point (x, y) defaults to the center of the circle.
- Parameters:
x – X coordinate of the circle.
y – Y coordinate of the circle.
radius – The desired radius.
segments – You can optionally specify how many distinct triangles the circle should be made from. If not specified it will be automatically calculated using the formula: max(14, int(radius / 1.25)).
color – The RGB or RGBA color of the circle, specified as a tuple of 3 or 4 ints in the range of 0-255. RGB colors will be treated as having an opacity of 255.
blend_src – OpenGL blend source mode; for example,
GL_SRC_ALPHA.blend_dest – OpenGL blend destination mode; for example,
GL_ONE_MINUS_SRC_ALPHA.batch – Optional batch to add the shape to.
group – Optional parent group of the shape.
program – Optional shader program of the shape.
Methods
__init__([position, radius, color, window, ...])Create a circle.
delete()Force immediate removal of the shape from video memory.
draw()Draw the circle and return itself.
get_shape_group()Creates and returns a group to be used to render the shap[e.
Attributes
anchor_positionGet/set the anchor's
(x, y)offset fromposition.anchor_xGet/set the X coordinate of the anchor point.
anchor_yGet/set the Y coordinate of the anchor point.
batchGet/set the
Batchfor this shape.blend_modeThe current blend mode applied to this shape.
Get/set the shape's color.
Get the coordinate system used for the circle.
groupGet/set the shape's
Group.opacityGet/set the blend opacity of the shape.
Get the position of the circle in pixels.
programThe current shader program.
Gets/set radius of the circle.
rotationGet/set the shape's clockwise rotation in degrees.
visibleGet/set whether the shape will be drawn at all.
xGet/set the X coordinate of the shape's
position.yGet/set the Y coordinate of the shape's
position.zGet/set the Z coordinate of the shape.
- property color: tuple[int, int, int, int]#
Get/set the shape’s color.
The color may set to:
An RGBA tuple of integers
(red, green, blue, alpha)An RGB tuple of integers
(red, green, blue)
If an RGB color is set, the current alpha will be preserved. Otherwise, the new alpha value will be used for the shape. Each color component must be in the range 0 (dark) to 255 (saturated).