如何获得图形圈的区域?

时间:2016-10-12 23:53:49

标签: python graphics area

我试图占据黄色圆圈的内部区域和其余圆圈的外部区域。但我不确定如何计算图形中圆圈的面积。

from graphics import *
import math
def main():
win = GraphWin('Archery Target',300,300)
center = Point(150,150)

w = Circle(center,100)
w.setFill('White')
w.draw(win)

b = Circle(center,80)
b.setFill('Black')
b.draw(win)

bl = Circle(center,60)
bl.setFill('Blue')
bl.draw(win)

r = Circle(center,40)
r.setFill('Red')
r.draw(win)

y = Circle(center,20)
y.setFill('Yellow')
y.draw(win)


msg1 = Text(Point(100, 280), "inner area = ", innerA)
msg1.draw(win)


msg = Text(Point(150, 20), "Click anywhere to close")
msg.setTextColor('red')
msg.draw(win)
win.getMouse()
win.close()

main()

0 个答案:

没有答案