Hi, I'm in a Python class and we were given the assignment to create our own graphic and my idea was to have a program that asks the user to click six points and then create a circle using the six points they clicked. Once they've done that I want eyes and a mouth to appear in the circle. I was wondering if that was possible or if I need to have them also click the points where the two eyes and nose should appear as well. I have the face written, it looks like this... def main(): winWidth = 200 # give a name to the window width winHeight = 150 # and height win = GraphWin('Face', winWidth, winHeight) # give title and dimensions win.setCoords(0, 0, winWidth, winHeight) # make right side up coordinates!
head = Circle(Point(40,100), 25) # set center and radius head.setFill("yellow") head.draw(win) eye1 = Circle(Point(30, 105), 5) eye1.setFill('blue') eye1.draw(win) eye2 = Line(Point(45, 105), Point(55, 105)) # set endpoints eye2.setWidth(3) eye2.draw(win) mouth = Oval(Point(30, 90), Point(50, 85)) # set corners of bounding box mouth.setFill("red") mouth.draw(win) message = Text(Point(winWidth/2, 20), 'Click anywhere to quit.') message.draw(win) win.getMouse() win.close() main() I'm struggling with the Circle, however. This is what I have so far, but it won't work. def main(): winWidth = 300 winHeight = 300 win = GraphWin('Draw a Circle', winWidth, winHeight) win.setCoords(0, 0, winWidth, winHeight) win.setBackground('yellow') message = Text(Point(winWidth/2, 20), 'Click on six points') message.draw(win) # Get and draw six points of circle p1 = win.getMouse() p1.draw(win) p2 = win.getMouse() p2.draw(win) p3 = win.getMouse() p3.draw(win) p4 = win.getMouse() p4.draw(win) p5 = win.getMouse() p5.draw(win) p6 = win.getMouse() p6.draw(win) points = [p1, p2, p3, p4, p5, p6] # Use Oval object to draw the circle Circle = Oval(points) Circle.setFill('green') Circle.setOutline('pink') Circle.setWidth(4) # width of boundary line Circle.draw(win) # Wait for another click to exit message.setText('Click anywhere to quit.') message.setTextColor('red') message.setStyle('italic') message.setSize(20) win.getMouse() win.close() Any advice you have would help out a lot. Thank you for your time. _______________________________________________ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor