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: Circle

A 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_position

Get/set the anchor's (x, y) offset from position.

anchor_x

Get/set the X coordinate of the anchor point.

anchor_y

Get/set the Y coordinate of the anchor point.

batch

Get/set the Batch for this shape.

blend_mode

The current blend mode applied to this shape.

color

Get/set the shape's color.

coordinates

Get the coordinate system used for the circle.

group

Get/set the shape's Group.

opacity

Get/set the blend opacity of the shape.

position

Get the position of the circle in pixels.

program

The current shader program.

radius

Gets/set radius of the circle.

rotation

Get/set the shape's clockwise rotation in degrees.

visible

Get/set whether the shape will be drawn at all.

x

Get/set the X coordinate of the shape's position.

y

Get/set the Y coordinate of the shape's position.

z

Get/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).

property coordinates: Unit#

Get the coordinate system used for the circle.

draw() Circle[source]#

Draw the circle and return itself.

property position: Tuple[float, float]#

Get the position of the circle in pixels.

property radius: float#

Gets/set radius of the circle.