Python精灵模块的draw_circle指令

所有命令 单独命令 屏幕命令 角色命令

角色命令 >> Python精灵模块的draw_circle画圆/扇形/弓形的指令

简介:这是角色的画圆/扇形/弓形的指令。这个命令最多有5个参数, 前面两个参数是必不可少的,用来描述直径,分别叫p1和p2。 为了能画扇形及弓形,及是否填充图形,还有叫degrees的参数,表示弧形转的度数。 isfill参数是逻辑参数,表示是否填充。shape是用来描述画扇形还是弓形的参数,默认值是'fan',表示画扇形。
例子:
from sprites import Sprite,Screen

p1 = (0,0)
p2 = (200,0)

screen = Screen()
screen.onmousemove(lambda x,y:screen.title(str(x)+"," + str(y)))

t = Sprite()
t.fillcolor('pink')
t.begin_fill()
t.draw_circle(p1,p2,180)  # 以p1和p2为直径为一个半圆
t.end_fill()

t.goto(100,100)
t.draw_circle((100,100),(200,200),180)

t.fillcolor('light green')
t.draw_circle((-150,-150),(-100,-200),90,True) # 画90度填充的扇形

p1 = (-10,50);p2 = (-50,150)
t.fillcolor('light cyan')
t.draw_circle(p1,p2,80,True,'bow')# 画80度填充的弓形

t.ht()
screen.mainloop()

writed by lixingqiu 关注"异编程"微信公众号,获取更多关于Python精灵模块的咨讯: