turtle画春联

turtle画春联_第1张图片

import turtle
#右边春联
turtle.penup()
turtle.goto(100,150)
turtle.pendown()
turtle.color('red','red')
turtle.begin_fill()
turtle.forward(50)
turtle.right(90)
turtle.forward(400)
turtle.right(90)
turtle.forward(50)
turtle.right(90)
turtle.forward(400)
turtle.end_fill()
#左边春联
turtle.right(90)
turtle.penup()
turtle.goto(-150,150)
turtle.pendown()
turtle.begin_fill()
turtle.forward(50)
turtle.right(90)
turtle.forward(400)
turtle.right(90)
turtle.forward(50)
turtle.right(90)
turtle.forward(400)
turtle.end_fill()
#上边春联
turtle.begin_fill()
turtle.right(90)
turtle.penup()
turtle.goto(-100,200)
turtle.pendown()
turtle.forward(200)
turtle.left(90)
turtle.forward(50)
turtle.left(90)
turtle.forward(200)
turtle.left(90)
turtle.forward(50)
turtle.end_fill()
#写右春联
turtle.penup()
turtle.goto(125,-250)
turtle.pendown()
turtle.color('black')
turtle.write('一\n年\n四\n季\n春\n常\n在',align='center',font=('宋体',43))
#写左春联
turtle.penup()
turtle.goto(-125,-250)
turtle.pendown()
turtle.color('black')
turtle.write('万\n紫\n千\n红\n总\n是\n春',align='center',font=('宋体',43))


你可能感兴趣的:(逻辑练习,python)