import turtle t = turtle.Pen() turtle.bgcolor("black") my_name=turtle.textinput("输入你的姓名","你的名字?") colors=["red","yellow","purple","blue"] for x in range(100): t.pencolor(colors[x%4]) t.penup() t.forward(x*4) t.pendown() t.write(my_name,font=("Arial",int((x+4)/4),"bold")) t.left(92)
#SquareSpiral1.py import turtle t = turtle.Pen() turtle.bgcolor("black") sides=6 colors=["red","yellow","green","blue","orange","purple"] for x in range(360): t.pencolor(colors[x%sides]) t.forward(x*3/sides+x) t.left(360/sides+1) t.width(x*sides/200) print("####结束####") # # ———————————————— # 版权声明:本文为CSDN博主「qq_14961401」的原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接及本声明。 # 原文链接:https://blog.csdn.net/qq_14961401/article/details/58595783