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 1PE
Program Plan Intro

Program to draw squares

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 Rectangle(), draw the square.
    • Using the method setOutline(), set the outline of the object to the given color.
    • Using the method setFill(), set the interior of the object to the given color.
    • Using the method draw(), draw the square inside the graphics window.
    • Using for loop, draw squares in the graphics window based on the range.
    • Using Text() method, display the message in graphics window.
    • Using close() method, close the graphics window.
  • Call the function “main()”.

Blurred answer
Students have asked these similar questions
Write a program that moves a circle up, down, left,or right using the arrow keys.
Write a program that prompts the user to enter the center x-, y-coordinates, width, and height of two rectangles and determines whether the second rectangle is inside the first or overlaps with the first, as shown in Figure 4.10. Test your program to cover all cases.
Write a program that animates a pendulum swinging,as shown in Figure . Press the up arrow key to increase the speed, and thedown arrow key to decrease it. Press the S key to stop animation of and the Rkey to resume it.
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
Database System Concepts
Computer Science
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:McGraw-Hill Education
Text book image
Starting Out with Python (4th Edition)
Computer Science
ISBN:9780134444321
Author:Tony Gaddis
Publisher:PEARSON
Text book image
Digital Fundamentals (11th Edition)
Computer Science
ISBN:9780132737968
Author:Thomas L. Floyd
Publisher:PEARSON
Text book image
C How to Program (8th Edition)
Computer Science
ISBN:9780133976892
Author:Paul J. Deitel, Harvey Deitel
Publisher:PEARSON
Text book image
Database Systems: Design, Implementation, & Manag...
Computer Science
ISBN:9781337627900
Author:Carlos Coronel, Steven Morris
Publisher:Cengage Learning
Text book image
Programmable Logic Controllers
Computer Science
ISBN:9780073373843
Author:Frank D. Petruzella
Publisher:McGraw-Hill Education
Java random numbers; Author: Bro code;https://www.youtube.com/watch?v=VMZLPl16P5c;License: Standard YouTube License, CC-BY