猫史档案馆


【Python作品分享】P16挑战1

用户:下雨的草灵灵下雨的草灵灵查看:0 回复:0 评论:0 创建时间:2020-09-26T20:20:55


【作品展示】

center_image

 

【作品介绍】

 

【作品源代码】

import turtle


# 完整的对联

t = turtle.Pen()
a = turtle.Pen()

t.fillcolor('red')
a.fillcolor('red')
a.penup()
a.setx(100)
a.pendown()

t.begin_fill()
a.begin_fill()
for i in range(2):
    t.forward(25)
    a.forward(25)
    t.right(90)
    a.right(90)
    t.forward(230)
    a.forward(230)
    t.right(90)
    a.right(90)
t.end_fill()
a.end_fill()

message1 = ['今', '年', '一', '定', '发', '大', '财']
message2 = ['不', '行', '明', '年', '接', '着', '来']
t.right(90)
a.right(90)
for i in range(7):
    t.penup()
    a.penup()
    t.forward(33)
    a.forward(33)
    t.pendown()
    a.pendown()
    t.write(message1[i],font=('Arial',20))
    a.write(message2[i], font=('Arial', 20))
turtle.done()

 

【提示】

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

https://python.codemao.cn


回复

上一页1 页 / 共 0下一页