猫史档案馆


【Python作品分享】浩瀚星海【作品秀】

用户:✨传奇✨泰拉悠悠球✨传奇✨泰拉悠悠球查看:0 回复:0 评论:0 创建时间:2021-07-23T22:52:57


【作品展示】

center_image

 

【作品介绍】

浩瀚星海

 

【作品源代码】

import turtle
import random



# 浩瀚星海
t = turtle.Pen()
color = ['blue', 'pink', 'yellow', 'lightgreen', 'orange', 'purple']
turtle.bgcolor('black')
t.speed(100)
while True:
    draw = turtle.textinput('喵', '喵')
    x = random.randint(-200, 200)
    y = random.randint(-200, 200)
    t.penup()
    t.goto(x,y)
    t.pendown()
    b=random.randint(0,5)
    t.hideturtle()
    t.fillcolor(color[b])
    if (draw == "1"):
        t.begin_fill()
        t.circle(7.5)
        t.end_fill()
    elif (draw == "2"):
        t.begin_fill()
        for i in range(5):
            t.forward(20)
            t.right(144)
        t.end_fill()
    elif (draw == "3"):
        break
    else:
        continue
    
turtle.done()

 

【提示】

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

https://python.codemao.cn


回复

上一页1 页 / 共 0下一页