Commit 6987690d by BellCodeEditor

save project

parent 7fd15acf
Showing with 14 additions and 1 deletions
#导入模块
import turtle import turtle
#导入画布
Screen=turtle.Screen() Screen=turtle.Screen()
#填充背景
Screen.bgcolor("light blue") Screen.bgcolor("light blue")
#创建画笔(画图)
creeper=turtle.Pen() creeper=turtle.Pen()
#创建画笔(写字)
pen1=turtle.Pen() pen1=turtle.Pen()
#抬笔
pen1.penup() pen1.penup()
pen1.goto(110,-10) pen1.goto(110,-10)
#写字格式,\n 是换行
pen1.write("诺依\n,python真不错",("Times",50,"normal")) pen1.write("诺依\n,python真不错",("Times",50,"normal"))
#开始填充
creeper.fillcolor("red") creeper.fillcolor("red")
creeper.pencolor("red") creeper.pencolor("red")
creeper.begin_fill() creeper.begin_fill()
creeper.pensize(5) creeper.pensize(5)
size=50 #弹出会话框
len=Screen.textinput("提示","你想要多大的爱心?")
#把字符串转化成整数
size=int(len)
creeper.left(45) creeper.left(45)
creeper.forward(size*2) creeper.forward(size*2)
creeper.circle(size,180) creeper.circle(size,180)
...@@ -19,5 +30,7 @@ creeper.circle(size,180) ...@@ -19,5 +30,7 @@ creeper.circle(size,180)
creeper.forward(size*2) creeper.forward(size*2)
creeper.end_fill() creeper.end_fill()
creeper.hideturtle() creeper.hideturtle()
#隐藏画笔
pen1.hideturtle() pen1.hideturtle()
#停留画布
turtle.done() turtle.done()
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment