小姑娘搗鼓了好久終於在大年三十用Python寫出了“福”,貼出來,效果如下
import turtle as t#背景t.pu()t.goto(-50,350)t.pd()t.setheading(45)t.fillcolor('red')t.begin_fill()for i in range(4): t.right(90) t.fd(450)t.end_fill()#金邊t.pencolor('yellow')t.pu()t.goto(-70,330)t.setheading(45)t.pd()for i in range(4): t.right(90) t.fd(450) t.pu() t.left(135) t.fd(40) t.left(225) t.pd()t.pencolor('black')t.pensize(11)a=11t.pu()t.goto(60,-120)t.setheading(160)t.pd()for i in range(30):#點 t.fd(1) t.pensize(a) a+=0.1 t.left(1.5)for i in range(30): t.fd(1) t.pensize(a) a-=0.1 t.left(-1.5)#橫t.pu()t.goto(100,-50)t.setheading(170)t.pd()for i in range(10): t.fd(1) t.pensize(a) a+=0.5for i in range(10): t.fd(1) t.pensize(a) a-=0.5a=15t.pensize(a)t.setheading(200)for i in range(100): t.fd(1)#撇t.right(140)a=15t.pensize(a)for i in range(140): t.fd(1) t.right(0.1)for i in range(60): t.fd(1) t.pensize(a) a-=0.18#豎 t.pu()t.goto(30,0)t.setheading(90)t.pd()a=14t.pensize(a)for i in range(100): t.fd(1)for i in range(50): t.fd(1) a+=0.1 t.pensize(a)#點 t.pu()t.goto(30,-5)t.setheading(150)t.pd()a=14t.pensize(a)for i in range(40): t.fd(1) t.right(0.7)#橫t.pu()t.goto(-60,-100)t.setheading(160)a=3t.pd()for i in range(20): t.pensize(a) t.fd(1) a+=0.5t.setheading(190)for i in range(80): t.fd(1)t.right(30)t.fd(5)#口#丨t.pu()t.goto(-40,-50)t.setheading(180)t.pd()a=4t.pensize(a)for i in range(10): t.fd(1) t.pensize(a) a+=1for i in range(10): t.fd(1) t.pensize(a) a-=0.5t.right(80)a=17for i in range(50): t.pensize(a) t.fd(1) a-=0.1 #—t.setheading(180)for i in range(50): t.fd(1) t.pensize(a) t.left(0.2)for i in range(50): t.fd(1) t.left(-0.2) #丨a=16t.pensize(a)t.setheading(260)for i in range(50): t.pensize(a) t.fd(1) a+=0.1#—t.pu()t.setheading(270)t.fd(7)t.pd()a=10t.pensize(a)t.setheading(10)for i in range(50): t.pensize(a) t.fd(1) a+=0.05 t.left(0.1)for i in range(30): t.pensize(a) t.fd(1) a+=0.05 t.left(-0.1)for i in range(20): t.pensize(a) t.fd(1) a-=0.5 t.left(-1) #田t.pu()t.goto(-30,50)t.setheading(100)t.pd()#|a=20t.pensize(a)for i in range(90): t.pensize(a) t.fd(1) a-=0.05for i in range(20): t.pensize(a) t.fd(1) a-=0.5#—t.pu()t.setheading(270)t.fd(5)t.pd()a=15t.pensize(a)t.setheading(190)for i in range(20): t.pensize(a) t.fd(1) a+=0.05for i in range(45): t.pensize(a) t.fd(1) a+=0.05 t.left(0.1)for i in range(75): t.pensize(a) t.fd(1) t.left(-0.2) #—t.pu()t.goto(-30,45)t.pd()a=15t.pensize(a)t.setheading(160)t.fd(30)t.setheading(190)t.fd(50)for i in range(90): t.pensize(a) t.fd(1) a+=0.05for i in range(18): t.pensize(a) t.fd(1.5) a+=0.1 t.right(6)#|for i in range(80): t.pensize(a) t.fd(1) a+=0.05t.setheading(70)for i in range(30): t.pensize(a) t.fd(1) a-=0.5#-t.pu()t.goto(-65,85)t.setheading(160)t.pd()a=6t.pensize(a)for i in range(15): t.fd(1) a+=0.5 t.pensize(a)t.setheading(190)for i in range(90): t.fd(1) t.right(0.06) #|t.pu()t.goto(-120,55)t.setheading(90)t.pd()a=20t.pensize(a)for i in range(80): t.fd(1) a-=0.1 t.pensize(a) #結束t.ht()
最新評論