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.
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...
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...
In Python. The file “essay.txt” attached to this assignment includes an essay. The essay includes a...
In Python. The file “essay.txt” attached to this assignment includes an essay. The essay includes a couple of sections that are separated by two consecutive newline characters (i.e. ‘\n’) that are shown as empty lines between the sections if you open the file in a text editor like Notepad. Each section starts with a title followed by a couple of paragraphs; the title and the paragraphs are separated by a newline character. Each paragraph includes a couple of sentences that...
Create a Python script in IDLE or Kali Python3 CLI to create the following Python Program:...
Create a Python script in IDLE or Kali Python3 CLI to create the following Python Program: Your program will create a username of your choice using a Kali Linux command "useradd -m mark", then set the password for that user using the Kali Linux Command "echo "mark:10101111" | chpasswd". Then you create a dictionary file using the Kali Linux command "crunch 8 8 01 > mylist.txt" Your python script should crack the password for that user and display on the...
For a hair cell of the organ of corti to depolarize which of the following must...
For a hair cell of the organ of corti to depolarize which of the following must open? a) sodium ligand-gated channel b) potassium ligand-gated channel c) potassium mechanically-gated channel d) sodium voltage gated channel e) potassium voltage gated-channel 2) which of the following is Not true concerning the ANS (autonomic nervous system)? a) the sympathetic division originates from the brainstem b) it utilizes ganglia c) parasympathetic axons are found in cranial nerve X (vagus) d) it always involves preganglionic and...
last year electric out of hair sales of 105 million in assets at the start of...
last year electric out of hair sales of 105 million in assets at the start of the year of 160 million if his return on star of your assets was 10% what was its operating profit margin?
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT