Skip to content
This repository was archived by the owner on Feb 11, 2025. It is now read-only.
This repository was archived by the owner on Feb 11, 2025. It is now read-only.

circle: crash if border_width is bigger than radius #6

@aoloe

Description

@aoloe

if a circle border_width is bigger than the circle radius, the script crashes.

Traceback (most recent call last):
  File "forever.py", line 3, in <module>
    circle = play.new_circle(x = 0, y = 0, radius = 5, border_color="black", border_width=20)
  File "venv/lib/python3.7/site-packages/play/play.py", line 533, in new_circle
    transparency=transparency, size=size, angle=angle)
  File "/venv/lib/python3.7/site-packages/play/play.py", line 553, in __init__
    self._compute_primary_surface()
  File "/venv/lib/python3.7/site-packages/play/play.py", line 571, in _compute_primary_surface
    pygame.draw.circle(self._primary_pygame_surface, _color_name_to_rgb(self._color), (center, center), self._radius-self._border_width)
ValueError: negative radius

it's ok, if it's a deliberate choice, but i think that play could use the maximum valid border.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions