turtle库基本使用

import turtle as t

t.pensize(2) 设置画笔粗细

Example:
>>> pensize()
1
>>> pensize(10) # from here on lines of width 10 are drawn

t.color('red','red)  设置画笔颜色和填充颜色

Example:
>>> color('red', 'green')
>>> color()
('red', 'green')
>>> colormode(255)
>>> color((40, 80, 120), (160, 200, 240))
>>> color()
('#285078', '#a0c8f0')

t.circle(10)   圆心在海龟左侧10像素的圆

circle(radius, extent=None, steps=None)  半径,角度,边数
Draw a circle with given radius.

>>> t.circle(50,360,6)
>>> t.circle(50,180,6)
>>> t.circle(50,180,6)

t.fd(100)  向前走100像素

t.begin_fill()  在绘制要填充的形状之前调用。t.end_fill() 填充调用begin_fill()后绘制的形状

Example:
>>> color("black", "red")
>>> begin_fill()
>>> circle(60)
>>> end_fill()

猜你喜欢

转载自www.cnblogs.com/lisi01/p/9902521.html
今日推荐