""" 直接设定坐标点定义海龟形状为正五边形 """ import turtle, math screen = turtle.getscreen() screen.title("直接设定坐标点定义海龟形状为正五边形") hg = turtle.Turtle(shape='blank',visible=False) hg.color("purple") hg.pensize(2) pentagon=[] R = 150 for n in range(0,5): x = R*math.cos(math.radians(n*72)) y = R*math.sin(math.radians(n*72)) pentagon.append((x,y)) screen.addshape('p',tuple(pentagon)) hg.shape('p') hg.st() while 1: hg.right(1) # 不停地旋转
李兴球
李兴球的博客是Python创意编程原创博客