Question

write a program that draws some sort of faces using python programming

write a program that draws some sort of faces using python programming

0 0
Add a comment Improve this question Transcribed image text
Answer #1

Please find the answer below::

from graphics import *
win = GraphWin('Smiley Faces', 400, 400) # give title and dimensions
win.setBackground('orange')
win.setCoords(0, 0, 400, 400)

def drawFace(center, size,window):

head = Circle(center,size*20)
head.setFill("green")
head.draw(win)

mouth = Circle(center, size*13)
mouth.setFill("red")
mouth.setOutline("red")
mouth.draw(win)
smile = Circle(center, size*14)
smile.move(0,size*4)
smile.setFill("green")
smile.setOutline("green")
smile.draw(win)

eyebrow = Circle(center,size*4)
eyebrow.move(-size*8,size*10)
eyebrow.setFill('black')
eyebrow.draw(win)
eyebrow2 = eyebrow.clone()
eyebrow2.draw(win)
eyebrow2.move(size*16, 0)
eyecircle = Circle(center,size*4)
eyecircle.move(-size*8,size*9)
eyecircle.setFill('green')
eyecircle.setOutline('green')
eyecircle.draw(win)
eyecircle2 = eyecircle.clone()
eyecircle2.draw(win)
eyecircle2.move(size*16, 0)

eyelid = Circle(center,size*3)
eyelid.move(-size*8,size*8)
eyelid.setFill('brown')
eyelid.draw(win)
eyelid2 = eyelid.clone()
eyelid2.draw(win)
eyelid2.move(size*16, 0)

eye = Circle(center, size*3)
eye.move(-size*8,size*6)
eye.setFill('orange')
eye.draw(win)
eye2 = eye.clone()
eye2.draw(win)
eye2.move(size*16, 0)

pupil = Circle(center,size)
pupil.move(-size*9,size*7)
pupil.setFill('blue')
pupil.draw(win)
pupil2 = pupil.clone()
pupil2.draw(win)
pupil2.move(size*16,0)

nose = Circle(center,size*3)
nose.move(0,-size*2)
nose.setOutline('yellow')
nose.setFill('yellow')
nose.draw(win)

def main():

center = Point(200,200)#top to bottom, increasing radius
drawFace(center,4,win)

message = Text(Point(200, 380), 'Click to exit')
message.setFill('blue')
message.draw(win)
win.getMouse()
win.close()

main()

output:

Add a comment
Know the answer?
Add Answer to:
write a program that draws some sort of faces using python programming
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT