Question

In: Computer Science

Create a python graphics of a smiley face of a dog that includes ears. must start...

Create a python graphics of a smiley face of a dog that includes ears. must start with : from graphics import * or import graphics

Solutions

Expert Solution

Here is the code that might help you.

MOOD_HAPPY = 1
02 MOOD_ANGRY = 2
03 MOOD_SLEEPING = 3
04 MOOD_BORED = 4
05 MOOD_HUNGRY = 5
06 MOOD_DEAD = 6
07
08 import graphics
09
10
11 class body:
12
13     def __init__(self):
14         #draw method should be
15         self.body_rect = graphics.Rectangle( )
16         #not sure what coords or how to put them in
17         #also not sure what else is needed to get a body and 2 box legs
18
19
20         
21     def draw(self, win):
22         self.body_rect.undraw(win) #clears screen so old image is gone
23         
24         self.body_rect.draw(win)
25         #also will need more for legs and tail stubb
26
27 class dog:
28
29     def __init__(self, first_mood):
30         self.mood = first_mood
31         self.body = body()
32         #I know it will also need to pull in other parts
33         #needs head, mouth, eyes
34
35
36     def draw(self, win):
37         #no undraws here because they are used in the other class/methods
38         self.body.draw(win)
39         #needs to draw each part of the dog
40         .....
41
42 #get body done with "stubbs"??? -- stubbing it out????
43
44 class eyes:
45
46     def __init__(self):
47         #thinking about a if/else loop for it to change the look of eyes
48         #not sure this will work or how to do it if so...
49         self.eyes = circle(point())
50         #not sure how to make it show eyes different with mood change
51         #thinking make them ovals for angry and round for everything else
52
53 class head:
54
55     def __init__(self):
56         #want the head to be a circle
57         self.head = circle(point())
58         #I am thinking same circle works for all moods, but need coords...

Related Solutions

with python, create a fake logo for a company using turtle graphics
with python, create a fake logo for a company using turtle graphics
Using Python 3 graphics, create a bouncing ball within a box. Allow the user to control...
Using Python 3 graphics, create a bouncing ball within a box. Allow the user to control the ball using their keyboard.
Solve please in python b) Create a program that shows a series of numbers that start...
Solve please in python b) Create a program that shows a series of numbers that start at a and increase from 5 to 5 until reaching b, where a and b are two numbers captured by the user and assumes that a is always less than b. Note that a and b are not necessarily multiples of 5, and that you must display all numbers that are less than or equal to b. c) Create a program that displays n...
Your (turtle) program in python must include: Create four Red turtles and four Blue turtles using...
Your (turtle) program in python must include: Create four Red turtles and four Blue turtles using one or more lists. • Start each of the Red turtles at a different random location on the left side of the screen within the range of the square formed by (-100, 100) and (0, -100) and each of the Blue turtles at a random location on the right side of the screen within the range of the square formed by (0, 100) and...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT