Commit 48d8c24d by BellCodeEditor

auto save

parent 07858a54
Showing with 25 additions and 0 deletions
import turtle #导入turtle模块(turtle模块是一个画图工具)
#背景颜色
screen=turtle.Screen() #创建画布
screen.bgcolor("light blue") #设置背景颜色为淡蓝色
#写字
pen=turtle.Pen() #创建画笔pen
pen.penup() #抬笔
pen.goto(100,-100) #画笔移动到(100,-100)的位置
pen.write("Hi,诺依~\npython真是太有趣啦~\n我也喜欢python~\n——悟空 ",font=("Times",20,"normal")) #写字
pen.hideturtle() #隐藏画笔
#画爱心
pen1=turtle.Pen() #创建画笔pen1
pen1.pencolor("red") #设置画笔颜色为红色
pen1.pensize(5) #设置画笔粗细为5
#借助变量
len=60 #将60赋值给变量len
pen1.left(45) #画笔pen1左转45度
pen1.forward(2*len) #画笔pen1移动2*len
pen1.circle(len,180) #利用circle画一个半径为len的半圆
pen1.right(90) #画笔pen1右转90度
pen1.circle(len, 180) #利用circle画一个半径为len的半圆
pen1.forward(2*len) #画笔pen1移动2*len
pen1.hideturtle() #隐藏画笔
turtle.done() #保存画布
\ No newline at end of file
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