diy1.py
526 Bytes
import turtle
screen=turtle.Screen()
l=screen.textinput("提示","你想要多大的爱心?")
len=int(l)
screen.bgcolor("light blue")
pen=turtle.Pen()
pen.up()
pen.goto(100,0)
pen.write("静夜思\n 李白\n 床前明月光,\n疑是地上霜。\n 举头望明月,\n 低头思故乡。",font=("Times",10,"normal"))
pen.goto(0,0)
pen.down()
pen.pensize(7)
pen.pencolor("red")
pen.left(45)
pen.forward(len*2)
pen.circle(len,180)
pen.right(90)
pen.circle(len,180)
pen.forward(len*2)
turtle.done()