diy.py
478 Bytes
import turtle
screen=turtle.Screen()
screen.bgcolor("light blue")
pen=turtle.Pen()
pen.penup()
pen.goto(100,-100)
pen.write("你好\n使用Python,\n有趣",font=("Times",18,"normal"))
pen.hideturtle()
pen1=turtle.Pen()
pen1.pencolor("red")
pen1.pensize(5)
len=screen.textinput("提示","多大的爱心?")
ls=int(len)
pen1.left(45)
pen1.forward(2*ls)
pen1.circle(ls,180)
pen1.right(90)
pen1.circle(ls,180)
pen1.forward(2*ls)
pen1.hideturtle()
turtle.done()