猫史档案馆


【Python作品分享】去太空,去编程【作品秀】

用户:28小邓同学28小邓同学查看:0 回复:0 评论:0 创建时间:2021-05-05T18:13:15


【作品展示】

center_image

 

【作品介绍】

参加比赛

 

【作品源代码】

import turtle
import random


t=turtle.Pen()
t.speed(0)
t.hideturtle()
t.pencolor('darkblue')
t.fillcolor('darkblue')
t.begin_fill()
t.penup()
t.goto(-350,350)
t.pendown()
for i in range(4):
    t.fd(700)
    t.right(90)
t.end_fill()


def wjx(x,y,z):
    t.penup()
    t.goto(x,y)
    t.pendown()
    t.pencolor('yellow')
    t.fillcolor('yellow')
    t.begin_fill()
    for i in range(5):
        t.right(144)
        t.fd(z)
    t.end_fill()

for j in range(30):
    x=random.randint(-250,250)
    z=random.randint(20,80)
    y=random.randint(-150,300)
    wjx(x,y,z)


t.penup()
t.goto(-100,0)
t.pendown()
t.pencolor('red')
t.write('100年',font=("Arial",75,'normal'))

def rocket(x,y):
    t.penup()
    t.goto(x,y)
    t.pendown()
    t.fillcolor('red')
    t.begin_fill()
    for a in range(3):
        t.fd(50)
        t.left(120)
    t.end_fill()
    t.pencolor('gray')
    t.fillcolor('gray')
    t.begin_fill()
    for b in range(4):
        t.fd(50)
        t.right(90)
    t.end_fill()
    t.right(90)
    t.fd(50)
    t.left(90)
    t.pencolor('red')
    t.fillcolor('red')
    t.begin_fill()
    t.forward(50)
    t.right(45)
    t.forward(70)
    t.setheading(180)
    t.forward(150)
    t.right(135)
    t.forward(70)
    t.end_fill()
    t.pencolor('blue')
    t.fillcolor('blue')
    t.begin_fill()
    t.penup()
    t.goto(x+25, y-37.5)
    t.pendown()
    t.circle(15)
    t.end_fill()

for c in range(6):
    t.setheading(0)
    rocket(-300+c*100,-250)

turtle.done()

 

【提示】

部分含有Python第三方库相关内容的作品,在海龟编辑器网页端无法运行哦!如遇到这种情况,可以打开下面的链接,下载海龟编辑器客户端:

https://python.codemao.cn


回复

上一页1 页 / 共 0下一页