猫史档案馆


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

用户:嘻__嘻__查看:1 回复:1 评论:1 创建时间:2021-05-05T23:33:25


【作品展示】

center_image

 

【作品介绍】

【去太空,趣编程】参赛作品—— 一辆火箭从太空飞过,还说了声“bye”。

 

【作品源代码】

import turtle
import random
import time
t = turtle.Pen()
t.speed(0)
turtle.bgcolor('black')
t.color('white')
def star():
    a = random.randint(25, 50)
    t.begin_fill()
    if (random.randint(0, 1) == 0):
        for i in range(5):
            t.forward(a)
            t.right(144)
            t.forward(a)
    else:
        for i in range(4):
            t.forward(a)
            t.right(36)
            t.forward(a)
            t.left(126)
    t.end_fill()
def b():
    a = random.randint(1, 10)
    t.dot(a)
    c = random.randint(3, 10)
    for i in range(c):
        t.forward((a + 2))
        t.backward((a + 2))
        t.right((360 / c))
turtle.tracer(0==1)
def go(x, y):
    t.penup()
    t.goto(x, y)
    t.pendown()
def bye():
    t.clear()
    go((-320), (-150))
    a = 'bye~~~ '
    for i in a:
        t.write(i, font = ('方正舒体', 150, 'italic'))
        t.forward(100)
        time.sleep(0.5)
def bye():
    t.clear()
    go((-320), (-150))
    a = 'bye~~~ '
    for i in a:
        t.write(i, font = ('方正舒体', 150, 'italic'))
        t.forward(100)
        time.sleep(0.5)
for i in range(50):
    t.penup()
    t.goto(random.randint((-300), 300), random.randint((-300), 300))
    t.pendown()
    b()
turtle.update()
t1 = turtle
def d():
    turtle.tracer(1==0)
    t1.right(90)
    t1.fillcolor('red')
    t1.begin_fill()
    for i in range(3):
        t1.forward(100)
        t1.left(120)
    t1.end_fill()
    t1.fillcolor('white')
    t1.begin_fill()
    for i in range(2):
        t1.forward(100)
        t1.right(90)
        t1.forward(200)
        t1.right(90)
    t1.right(90)
    t1.forward(150)
    t1.end_fill()
    t1.fillcolor('red')
    t1.begin_fill()
    for i in range(2):
        t1.forward(50)
        t1.right(90)
    t1.end_fill()
    t1.right(90)
    t1.forward(150)
    t1.left(90)
    t1.forward(50)
    t1.left(180)
    t1.fillcolor('red')
    t1.begin_fill()
    for i in range(2):
        t1.forward(50)
        t1.left(90)
    t1.end_fill()
    t1.left(90)
    t1.forward(75)
    t1.left(90)
    t1.forward(25)
    t1.right(90)
    t1.color('grey')
    t1.pensize(50)
    t1.forward(50)
    t1.backward(25)
    t1.left(90)
    t1.forward(25)
    t1.pensize(1)
    t1.pencolor('black')
    t1.penup()
    t1.left(180)
    t1.forward(275)
    t1.left(90)
    t1.forward(100)
    t1.right(90)
    turtle.update()
t1.goto(0,-300)
for i in range(16):
    t1.clear()
    t1.setheading(0)
    t1.forward(1)
    t1.pendown()
    d()
    time.sleep(0.1)
time.sleep(1)
bye()

 

【提示】

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

https://python.codemao.cn


回复

上一页1 页 / 共 1下一页
无题_无题_

建议火箭改成竖着飞呀,不错不错,加油~

点赞0


评论