def renderPolygon(): # Creating the global variables for the amount of sides, side length, the rotation angle, and the mouse button being pressed global sides, sideLength, angle # Drawing the polygon centre = (pygame.mouse.get_pos()) points = Polygon.GetPoints(sides, sideLength, centre[0], centre[1], angle) pygame.draw.lines(background, pygame.Color("black"), False, points) for p in range(len(points) - 1): pygame.draw.line(background, pygame.Color("black"), (centre[0], centre[1]), points[p]) screen.blit(background, (0, 0))