0

好吧,伙计们,我正在尝试画杰克灯笼,它应该包括一个绿色的茎一个橙色的身体两只眼睛一个鼻子一个嘴现在我知道我必须使用下面的圆形+多边形+矩形来完成它,这就是我的已经开始

def hal():
win = GraphWin("My Circle", 200, 200)
c = Circle(Point(100,100), 50)
c.setFill("Orange")
c.draw(win)
p1 = 50
p2 = 40
p3 = 50
eye= Polygon(p1,p2,p3) ###here is my problem, I could not get it, how can I center 

把它放在圆圈里,这样我就可以做眼睛了,比如我必须使用什么数字才能把它放在圆圈里,我怎么知道,所以我知道将来该怎么做

eye.setFill("Red")
eye.draw(win)
win.getMouse()

同样对于矩形,我怎么知道如何将它定位在圆的顶部,有什么办法可以知道吗?

谢谢

我正在使用 python 3.3 和这个图形库 http://mcsp.wartburg.edu/zelle/python/graphics.py

4

1 回答 1

0

好的,我明白了,只是我必须更改这里的数字是也有一些描述的代码

enter code heredef pumpkin():
win = GraphWin("My Circle", 800,600)
c = Circle(Point(400,400),200)
c.setFill("Orange")
c.draw(win)
eye= Polygon(Point(500,270), Point(430,400), Point(550,400))
eye.setOutline("yellow")
eye.setFill("Red")
eye.draw(win)  #lesgoleft,#les=up,lessgoleft
reye= Polygon(Point(250,280), Point(230,400), Point(350,400))
reye.setOutline("yellow")
reye.setFill("Red")
reye.draw(win)#moreright
moth=Polygon(Point(250,500), Point(450,540), Point(370,500))
moth.setOutline("yellow")
moth.setFill("Red")
moth.draw(win)                             #moregoright
nose=Polygon(Point(380,400), Point(340,480), Point(500,480))
nose.setOutline("yellow")
nose.setFill("Red")
nose.draw(win)
up= Rectangle(Point(360,200),Point(430,100))
up.setFill("dark green")
up.draw(win)
win.getMouse()
win.close()
于 2013-11-04T03:42:20.813 回答