Skip to content

No float coordinates issues in pygame 1.9.6 #6

@aleloi

Description

@aleloi

Getting a bunch of errors like these in python 3.8.10+pygame 1.9.6:

pygame 1.9.6
Hello from the pygame community. https://www.pygame.org/contribute.html
analogchessV4.py:47: DeprecationWarning: an integer is required (got type float).  Implicit conversion to integers using __int__ is deprecated, and may be removed in a future version of Python.
  pygame.draw.polygon(surf, c, pts)
Traceback (most recent call last):
  File "analogchessV4.py", line 1214, in <module>
    piece.draw_paths(pieces)
  File "analogchessV4.py", line 535, in draw_paths
    draw_line_round_corners_polygon(see_through, to_screen_coords((self.start_x,self.start_y)), to_screen_coords(end_pos), RED_HIGHLIGHT, self.radius*2*640/8)
  File "analogchessV4.py", line 48, in draw_line_round_corners_polygon
    pygame.draw.circle(surf, c, p1, round(w / 2))
TypeError: integer argument expected, got float

It's easy to fix by converting all float lengths and coords to int

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions