You could also generate a list of vertices for the polygon using code (some trigonometry) and set polygon.vertices
to that value. Remember to set closeShape = False
. I’m not sure that it’s simpler, but it’s more robust and flexible.
Something like this (untested):
center = (0, 0) # position of the circle
angles = (30, 90) # angles of the slice in degrees
r = 0.5 # radius, in whatever units the window uses
vertices = [(r*cos(np.deg2rad(angle))+center[0], r*sin(np.deg2rad(angle))+center[1]) for angle in range(angles[0], angles[1])]
polygon.vertices = vertices
Produces one point for each degree for code convenience. If you want to change the resolution, this is the range...
part, perhaps using np.linspace
.