Question

In: Computer Science

Create a python graphics of a smiley face that includes hair and eyebrows. must start with...

Create a python graphics of a smiley face that includes hair and eyebrows.

must start with : from graphics import * or import graphics

code must include these dimensions:

Head: Circle(Point(400,400), 200)

R Eye: Circle(Point(350,350), 20)

L Eye: Circle(Point(450,350), 20)

Mouth1: Oval(Point(300,500),Point(500,400))

Mouth2: Oval(Point(315,475), Point(485,375))

Solutions

Expert Solution

Code :

from graphics import *

def main():
  
#Draw Data:
win = GraphWin("Smiley Face", 800, 800) # Create Graphics Windows & give title and dimensions

head = Circle(Point(400,400), 200) # set center and radius
head.draw(win) # Draw head in Graphics Windows

reye = Circle(Point(350,350), 20) # set center and radius
reye.draw(win) # Draw right eye in Graphics Windows

leye = Circle(Point(450,350), 20) # set center and radius
leye.draw(win) # Draw left eye in Graphics Windows

mt1 = Oval(Point(300,500),Point(500,400)) # set corners of bounding box
mt1.draw(win) # Draw mouth 1 in Graphics Windows

mt2 = Oval(Point(315,475), Point(485,375)) # set corners of bounding box
mt2.draw(win) # Draw mouth 2 in Graphics Windows

# Draw Right Evebrow
line1 = Line(Point(315, 350), Point(350, 320)) # set endpoints
line1.draw(win) # Draw line
  
line2 = Line(Point(350, 320), Point(385, 350)) # set endpoints
line2.draw(win) # Draw line
  
# Draw Left Evebrow
line3 = Line(Point(415, 350), Point(450, 320)) # set endpoints
line3.draw(win) # Draw line
  
# Draw Hairs
line4 = Line(Point(450, 320), Point(485, 350)) # set endpoints
line4.draw(win) # Draw line
  
line5 = Line(Point(225, 300), Point(300, 100)) # set endpoints
line5.draw(win) # Draw line
  
line6 = Line(Point(575, 300), Point(500, 100)) # set endpoints
line6.draw(win) # Draw line
  
line7 = Line(Point(300, 100), Point(400, 150)) # set endpoints
line7.draw(win) # Draw line
  
line8 = Line(Point(500, 100), Point(400, 150)) # set endpoints
line8.draw(win) # Draw line
  
message = Text(Point(win.getWidth()/2, 20), 'Click anywhere to quit.') # Set text position
message.draw(win) # Draw the prompting text
win.getMouse() # waits for a mouse click
win.close() # closes the graphics window

main()

Output:

Please thumbs up for my solution.


Related Solutions

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
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.
Pixel data is not necessarily arranged into a rectangular grid. E.g., a smiley face is a...
Pixel data is not necessarily arranged into a rectangular grid. E.g., a smiley face is a round image true or false?
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...
Create a Python program that includes each feature specified below. Comments with a detailed description of...
Create a Python program that includes each feature specified below. Comments with a detailed description of what the program is designed to do in a comment at the beginning of your program. Comments to explain what is happening at each step as well as one in the beginning of your code that has your name and the date the code was created and/or last modified. The use of at least one compound data type (a list, a tuple, or a...
Create a Python file num_utils.py that includes: A function sum_of_nums that accepts 1 or more number...
Create a Python file num_utils.py that includes: A function sum_of_nums that accepts 1 or more number parameters and returns their sum without displaying anything A function product_of_nums that accepts 1 or more number  parameters and returns their product without displaying anything A function average_of_nums  that accepts 1 or more number  parameters and returns their average without displaying anything Create a Python file test_num_utils.py that: Imports num_utils Defines a function test_num_utils that demonstrates the use of the utilities in num_utils.py Executes test_num_utils
Curly Hair is a Brazilian start-up that offers a wide portfolio of hair products (shampoo, conditioner,...
Curly Hair is a Brazilian start-up that offers a wide portfolio of hair products (shampoo, conditioner, foam, serum…) specifically designed to take care of curly hair. Curly Hair manufactures its products in three different plants and sells them in five markets around the country. The plants have a certain manufacturing capacity. In the tables below, you can find the demand for each market, the capacity of each plant, and the distances (in miles) between plants and markets. Demand per market...
* Write a program texttriangle.py. in python This, too, is not a graphics program. Prompt the...
* Write a program texttriangle.py. in python This, too, is not a graphics program. Prompt the user for a small positive integer value, that I’ll call n. Then use a for-loop with a range function call to make a triangular arrangement of ‘#’characters, with n ‘#’ characters in the last line. Hint: [5] Then leave a blank line. Then make a similar triangle, except start with the line with n ‘#’ characters. To make the second triangle, you can use...
Sketch! This assignment is to write a Python program that makes use of the OpenGL graphics...
Sketch! This assignment is to write a Python program that makes use of the OpenGL graphics library to make an interactive sketching program that will allow the user to do line drawings. The user should be able to choose from a palette of colors displayed on the screen. When the user clicks the mouse in the color palette area, the drawing tool will switch to using the color selected, much like dipping a paint brush into a new color of...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT