#ezgraphics_rosette.py import math from ezgraphics import GraphicsWindow size = int(input("Enter size of 'rosette': ")) radius = size / 2 num_points = int(input("Enter number of points: ")) margin = 20 win = GraphicsWindow(size+margin,size+margin) canvas = win.canvas() canvas.setBackground("yellow") canvas.setColor("red") points = [] for p in range(num_points): alpha = 2*math.pi/num_points * p sin_p = math.sin(alpha) cos_p = math.cos(alpha) points.append((cos_p*radius+radius+margin/2,sin_p*radius+radius+margin/2)) for from_pt in range(num_points): for to_pt in range(from_pt+1,num_points): canvas.drawLine(points[from_pt][0], points[from_pt][1],\ points[to_pt][0], points[to_pt][1]) win.wait()