Question: Make a program faces.py that asks the user to click the mouse, and then draws a face at the point where the user clicked. Copy
Make a program faces.py that asks the user to click the mouse, and then draws a face at the point where the user clicked. Copy the makeFace function definition from the previous exercise, and use it! Elaborate this with a Simple Repeat Loop, so this is repeated six times: After each of 6 mouse clicks, a face immediately appears at the location of the latest click. Think how you can reuse your code each time through the loop!
def makeFace(center, win): '''display face centered at center in window win. Return a list of the shapes in the face. ''' head = Circle(center, 25) head.setFill("yellow") head.draw(win) eye1Center = center.clone() # face positions are relative to the center eye1Center.move(-10, 5) # locate further points in relation to others eye1 = Circle(eye1Center, 5) eye1.setFill('blue') eye1.draw(win) eye2End1 = eye1Center.clone() eye2End1.move(15, 0) eye2End2 = eye2End1.clone() eye2End2.move(10, 0) eye2 = Line(eye2End1, eye2End2) eye2.setWidth(3) eye2.draw(win) mouthCorner1 = center.clone() mouthCorner1.move(-10, -10) mouthCorner2 = mouthCorner1.clone() mouthCorner2.move(20, -5) mouth = Oval(mouthCorner1, mouthCorner2) mouth.setFill("red") mouth.draw(win) Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
