python turtle教程4

 时间:2026-02-14 12:43:39

1、这里我会主要介绍一些画笔的控制。

画笔开启 pendown() or pd() or down()

turtle.pendown() or turtle.pd() turtle.down()

当开启时移动画笔会在画布上留下路径

python turtle教程4

2、画笔关闭 penup() or pu() or up()

turtle.penup() or turtle.pu() turtle.up()

pu 和 up 都可以的,就是有点绕

当画笔关闭时,移动画笔不会再画布上留下路径。

python turtle教程4

3、改变画笔的尺寸 pensize() or width()

turtle.pensize() or turtle.width() #获取当前的画笔尺寸

turtle.pensize(x) or turtle.width(x) #将画笔尺寸改为x

python turtle教程4

4、获取画笔的整体属性以及修改 pen

turtle.pen()

其中的属性如下

“shown”: True/False

“pendown”: True/False

“pencolor”: color-string or color-tuple

“fillcolor”: color-string or color-tuple

“pensize”: positive number

“speed”: number in range 0..10

“resizemode”: “auto” or “user” or “noresize”

“stretchfactor”: (positive number, positive number)

“outline”: positive number

“tilt”: number

python turtle教程4

5、如要利用pen改变画笔的属性,只要将要改的属性赋予一个明确的值即可。

turtle.pen(fillcolor='black',pencolor ='red')

python turtle教程4

6、获取画笔是否放下 isdown()

turtle.isdown()

如果放下或开启则是 True

抬起或关闭则是 False

python turtle教程4

  • 吉利收购魅族手机
  • 机器人脑立体定向技术原理
  • 斗鱼直播怎么调整弹幕的字号?
  • 数码宝贝怎么查看战力排行?
  • 水晶捆蹄的做法
  • 热门搜索
    第七届世界军人运动会 意外的什么作文 幼儿园健康知识讲座 防雷知识 c1能开什么样的货车 周记可以写什么 有什么好看的恐怖片 鹌鹑蛋的功效与作用 运动会进行曲 鹿鞭的功效与作用