Python Programming: An Introduction to Computer Science, 3rd Ed.
Python Programming: An Introduction to Computer Science, 3rd Ed.
3rd Edition
ISBN: 9781590282755
Author: John Zelle
Publisher: Franklin, Beedle & Associates
bartleby

Videos

Question
Book Icon
Chapter 4, Problem 3PE
Program Plan Intro

Program to draw a face

Program plan:

  • Import the required graphics package.
  • Define the main method.
    • Using the object GraphWin(), to display the graphics window.
    • Using the method setCoords(), set the size of the graphics window.
    • Using the method Oval(),draw an oval to represent head.
    • Using the method Circle(),draw a circle to represent eyes.
    • Using the method Rectangle(), draw the rectangle to represent mouth.
    • Using for loop, draw teeth by cloning the Rectangle object.
    • Using the method Line(), draw the line in Rectangle object to represent lips.
  • Call the function “main()”.

Blurred answer
Students have asked these similar questions
Write a program that draws four squares in the center of the screen, as shown in Figure 1.18a.
You are to write a program that allows the user to draw a simple house using 5 mouse clicks. - The first two clicks will be the opposite corners of the rectangular frame of the house. - The third click will indicate the center of the top edge of the rectangular door. The door should have a total width that is 1/5 of the width of the house frame. The sides of the door should extend from the corners of the top down to the bottom of the frame. - The 4th click will indicate the center of a square window. The window is as wide as the door. (A change from the original book program.) - The last click will indicate the peak of the roof. The edges of the roof will extend from the point at the peak to the corners of the top edge of the house frame. Make the lines of the roof edge green. (Another change from the original book program.)
Write a program that displays twocircles with radius 10 at location (40, 40) and (120, 150) with a line connectingthe two circles, as shown in Figure . The distance between the circlesis displayed along the line. The user can drag a circle. When that happens, thecircle and its line are moved, and the distance between the circles is updated.
Knowledge Booster
Background pattern image
Computer Science
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
SEE MORE QUESTIONS
Recommended textbooks for you
  • Text book image
    Systems Architecture
    Computer Science
    ISBN:9781305080195
    Author:Stephen D. Burd
    Publisher:Cengage Learning
Text book image
Systems Architecture
Computer Science
ISBN:9781305080195
Author:Stephen D. Burd
Publisher:Cengage Learning
Memory Management Tutorial in Java | Java Stack vs Heap | Java Training | Edureka; Author: edureka!;https://www.youtube.com/watch?v=fM8yj93X80s;License: Standard YouTube License, CC-BY