Question

Write a program that displays a winter scene in a graphics window. The scene must include...

Write a program that displays a winter scene in a graphics window. The scene must include a tree and a snowman. Hint: Use colored rectangles for the tree and white circles for the body of the snowman.

This needs to be written using Python language.

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

'''A simple graphic that depicts a snowman and a tree.

'''

from graphics import *

win = GraphWin('Snowman', 400, 400)

win.setBackground('cyan')

def shapes(x,y,dx,dy):

for i in range (3):

cloud = Oval(Point (y-50,x), Point(dy,80))

cloud.setFill('white')

cloud.setOutline('white')

cloud.draw(win)

shape = Oval(Point (x,y), Point(dx,dy))

shape.setFill('white')

shape.setOutline('white')

shape.draw(win)

tri = Polygon(Point(270,y-50),Point(x+170,y+10),Point(dx+200,y+10))

tri.setFill('green')

tri.setOutline('green')

tri.draw(win)

x = x-10

y = y+50

dx = dx+10

dy = dy+55

tri = Polygon(Point(x+150,y+50),Point(x+125,y-25),Point(x+175,y-25))

return shapes

def main():

land = Oval(Point(-150,280),Point(500,500))

land.setFill('gray92')

land.setOutline('gray')

land.draw(win)

trunk = Line(Point(270,200), Point(270,350))

trunk.setOutline('chocolate')

trunk.setWidth(10)

trunk.draw(win)

shapes(50,150,120,210)

eye1 = Circle(Point(70,175),5)

eye1.setFill('black')

eye1.draw(win)

eye2 = eye1.clone()

eye2.move(30,0)

eye2.draw(win)

mouth = Oval(Point(70,190),Point(100,195))

mouth.setFill('red')

mouth.draw(win)

nose = Polygon(Point(85,175), Point(80,185), Point(90,185))

nose.setFill('orange')

nose.draw(win)

rect = Rectangle(Point(20,312), Point(150,350))

rect.setFill('gray92')

rect.setOutline('gray92')

rect.draw(win)

scarf = Polygon(Point(58,205), Point(85,220),Point(85,240),Point(85,220), Point(112,205), Point(85,220))

scarf.setOutline('brown')

scarf.setWidth('10')

scarf.draw(win)

message = Text(Point(200, 20), 'Click anywhere to quit.')

message.setFill('blue')

message.draw(win)

win.getMouse()

win.close()

main()

Add a comment
Know the answer?
Add Answer to:
Write a program that displays a winter scene in a graphics window. The scene must include...
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
ADVERTISEMENT