python——turtle的应用

python——turtle的应用,第1张

根据俺的无脑想法,一顿无脑 *** 作。弄出来个啥东西!!!

给大家欣赏欣赏!!!

from turtle import *
import time
a = [-400,-280]
b = [-368,-248]
c = [60,120]
setup(1000,800)
screensize(1000,800,'pink')
pencolor('black')
pensize(3)
speed(10)

#乌龟向某坐标点无痕迹移动
def yudon(x,y):
    up()
    goto(x,y)
    pd()

#小红花
def xiaohonhua():
    speed(10)
    begin_fill()
    right(90)
    fillcolor('green')
    fd(10)
    circle(10,180)
    end_fill()
    begin_fill()
    fillcolor('green')
    for i in range(9):
        fd(10)
        right(140)
        fd(10)
        circle(10,180)
    fd(10)
    end_fill()
    begin_fill()
    fillcolor('red')
    left(290)
    circle(30,360)
    end_fill()
    right(70)
    begin_fill()


for i in range(2):
    yudon(a[i],0)
    left(c[i])
    fd(100)
    right(120)
    fd(100)
    yudon(b[i],0)
    begin_fill()
    fillcolor('red')
    circle(20,360)
    end_fill()
yudon(-330,-40)
right(30)
circle(40,180)
yudon(-420,0)
left(180)
circle(130,360)
yudon(-50,100)
#第一个小红花
xiaohonhua()
yudon(80,100)
#第二个小红花
xiaohonhua()
yudon(220,110)
#第三个小红花
xiaohonhua()
yudon(-20,65)
xx = '恭'
write(xx, font=('Arial', 30, 'bold'), align="center")
yudon(92,50)
xx = '喜'
write(xx, font=('Arial', 30, 'bold'), align="center")
yudon(205,63)
xx = '你'
write(xx, font=('Arial', 30, 'bold'), align="center")
yudon(-350,-5)
xx = '羡'
write(xx, font=('Arial', 15, 'bold'), align="center")
yudon(-230,-5)
xx = '慕'
write(xx, font=('Arial', 15, 'bold'), align="center")
yudon(0,200)
pencolor('red')
xx = '专属表彰'
write(xx, font=('Arial', 50, 'bold'), align="center")
pencolor('black')
yudon(150,-200)
xx = '我们是世界的尘埃\n却也是自己的英雄\n\n            -----给正在努力的那个你'
write(xx, font=('Arial', 20, 'bold'), align="center")
hideturtle()
done()

 

运行效果

 

 

欢迎分享,转载请注明来源:内存溢出

原文地址: http://www.outofmemory.cn/langs/798345.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-05-06
下一篇 2022-05-06

发表评论

登录后才能评论

评论列表(0条)

保存