猫史档案馆


【Python作品分享】坏坏的棋盘就是这么坏【作品秀】

用户:旅行者N号旅行者N号查看:0 回复:1 评论:0 创建时间:2023-11-26T22:22:23


【作品展示】

center_image

 

【作品介绍】

坏坏的棋盘

 

【作品源代码】

from turtle import *
penup()
speed(0)
setup(500,500,0,0)
color('yellow')
goto(-2000, 500)
begin_fill()
goto(2000, 500)
goto(2000, -500)
goto(-2000, -500)
goto(-2000, 500)
end_fill()
color('black')
for y in range(-154, 176, 22):
    setx(-154)
    sety(y)
    pendown()
    setx(154)
    penup()
for x in range((-154), 176, 22):
    setx(x)
    sety(154)
    pendown()
    sety((-154))
    penup()
# 天元
goto((-1), (-1))
pendown()
pensize(5)
goto(1, (-1))
goto(1, 1)
goto((-1), 1)
goto((-1), (-1))
pu()
# 星位-1
goto(87, (-89))
pd()
goto(89, (-89))
goto(89, (-87))
goto(87, (-87))
goto(87, (-89))
penup()
# 星位-2
goto((-87), (-89))
pendown()
goto((-89), (-89))
goto((-89), (-87))
goto((-87), (-87))
goto((-87), (-89))
penup()
# 星位-3
goto((-87), 89)
pd()
goto((-89), 89)
goto((-89), 87)
goto((-87), 87)
goto((-87), 89)
penup()
# 星位-4
goto(87, 89)
pendown()
goto(89, 89)
goto(89, 87)
goto(87, 87)
goto(87, 89)
penup()
# 开始加粗边框
pensize(3)
goto((-154), 154)
pendown()
goto(154, 154)
goto(154, (-154))
goto((-154), (-154))
goto((-154), 154)
penup()
goto(2000, 0)  # 画笔飞走了
a=0
b=0
while True:
    for c in range(0, 500):
        setup(500, 500, a, b)
        a += 0.4
    for c in range(0, 500):
        setup(500, 500, a, b)
        b += 0.4
    for c in range(0, 500):
        setup(500, 500, a, b)
        a -= 0.4
    for c in range(0, 500):
        setup(500, 500, a, b)
        b -= 0.4

 

【提示】

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

https://python.codemao.cn


回复

上一页1 页 / 共 1下一页
旅行者N号旅行者N号

其中有一部分语法网页端Py会报错,客户端不会,建议:海龟编辑器1.7.6

点赞0


评论