Commit 41bc895f by BellCodeEditor

auto save

parent c66a449e
Showing with 47 additions and 22 deletions
# 利用write()帮助悟空给诺依回信吧~ import turtle # 导入turtle模块
import turtle screen=turtle.Screen() # 创建画布
screen=turtle.Screen() screen.bgcolor("light blue") # 设置背景颜色,括号里填颜色的英文单词
screen.bgcolor("light blue") p=turtle.Pen() # 创建一支名为p的画笔
len=screen.textinput("100","100") p.penup()
len=int(len) p.goto(100,-100)
pen=turtle.Pen() p.write("但愿人长久,\n千里共婵娟。",font=("Times",20,"normal")) # 用turtle在画布上写字
pen.write("你好\nSB.",font=("Times",30,"normal")) # 画爱心
pen.hideturtle() n=screen.textinput("画爱心","你想画多大的爱心?")
len=60 r=int(n)
pen.penup() z=turtle.Pen() # 创建一支名为z的画笔
pen.goto(100,100) z.pensize(5) # 设置画笔粗细为5
pen.pendown() z.pencolor("red") # 设置画笔颜色
pen.pensize(5) z.left(45)
pen.pencolor("red") z.fd(2*r)
pen.left(45) z.circle(r,180) # 画右边半圆
pen.forward(2*len) z.right(90)
pen.circle(len,180) z.circle(r,180) # 画左边半圆
pen.right(90) z.fd(2*r)
pen.circle(len,180) z.hideturtle() # 隐藏画笔
pen.forward(2*len) p.hideturtle()
turtle.done() turtle.done() # 保存画布
# 画圆
# pen.circle(半径) 正数逆时针,负数顺时针
# 画圆弧
# pen.circle(半径,角度)
# "#"在python中是注释符号
# 多行注释:ctrl+/
#画笔默认向右
# pen.pensize() # 设置画笔粗细(大小),括号里填数字,数字越大,画笔越粗。
# pen.pencolor() # 设置画笔颜色,括号里填颜色的英文单词
# pen.goto(x坐标,y坐标) # 画笔移到具体位置
# pen.penup() # 抬笔
# pen.pendown() # 落笔
# screen.textinput("窗口标题","提示语") # 在画布上弹出一个对话框
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