Question

Phython 3 Assignment. Write a graphics program to display (draw) a simple house using at least...

Phython 3 Assignment.

Write a graphics program to display (draw) a simple house using at least 4 shapes and 3 different colors. Add some landscaping too!

Please use comments to explain you code

0 0
Add a comment Improve this question Transcribed image text
Answer #1

shapes.py

import turtle

def sunImage(drawingFactor,io,qq,sz):
drawingFactor.setheading(0)
drawingFactor.fillcolor("yellow")
drawingFactor.penup()
drawingFactor.goto(io,qq)
drawingFactor.pendown()
drawingFactor.begin_fill()
drawingFactor.circle(sz)
drawingFactor.end_fill()
  
def cloudImage(drawingFactor,io,qq):
drawingFactor.setheading(90)
drawingFactor.fillcolor("white")
drawingFactor.penup()
drawingFactor.goto(io,qq)
drawingFactor.pendown()
drawingFactor.begin_fill()

drawingFactor.color("white")
for io in range(10):
drawingFactor.circle(20)
drawingFactor.right(36)
drawingFactor.forward(10)
drawingFactor.end_fill()
drawingFactor.setheading(90)  

def HousingFences(drawingFactor):
drawingFactor.setheading(90)
drawingFactor.color(0,0,0)  
drawingFactor.penup()
drawingFactor.goto(-200,-200)
drawingFactor.pendown()
drawingFactor.setheading(90)

drawingFactor.fillcolor(115,79,3)
drawingFactor.begin_fill()
for io in range(13):
drawingFactor.forward(100)
drawingFactor.right(45)
drawingFactor.forward(20)
drawingFactor.right(90)
drawingFactor.forward(20)
drawingFactor.right(45)
drawingFactor.forward(100)
drawingFactor.left(90)
drawingFactor.forward(4)
drawingFactor.left(90)
drawingFactor.end_fill()

drawingFactor.penup()
drawingFactor.goto(47,-140)
drawingFactor.pendown()
drawingFactor.fillcolor(177,188,177)
drawingFactor.begin_fill()
drawingFactor.circle(7)
drawingFactor.end_fill()
drawingFactor.begin_fill()
drawingFactor.fillcolor(115,79,3)
drawingFactor.penup()
drawingFactor.goto(44,-140)
drawingFactor.pendown()
drawingFactor.circle(4)
drawingFactor.end_fill()

ord = [-50,-190]
ord1 = [-50,-130]
lnt = [ord,ord1]
for qq in range(2):
drawingFactor.penup()
drawingFactor.goto(lnt[qq])
drawingFactor.fillcolor(177,188,177)
drawingFactor.begin_fill()
drawingFactor.pendown()
for io in range (2):
drawingFactor.forward(10)
drawingFactor.right(90)
drawingFactor.forward(15)
drawingFactor.right(90)
drawingFactor.end_fill()
drawingFactor.setheading(90)   
  

def housing(drawingFactor):
drawingFactor.color(0,0,0)  
drawingFactor.penup()
drawingFactor.goto(-160,-20)
drawingFactor.pendown()
drawingFactor.setheading(90)
drawingFactor.fillcolor("white")
drawingFactor.begin_fill()
drawingFactor.forward(150)
ceiling=drawingFactor.position()
drawingFactor.right(90)
drawingFactor.forward(300)
ceiling1 = drawingFactor.position()
drawingFactor.right(90)
drawingFactor.forward(150)
drawingFactor.right(90)
drawingFactor.forward(300)
drawingFactor.right(90)
drawingFactor.end_fill()
drawingFactor.penup()
drawingFactor.goto(ceiling)
drawingFactor.fillcolor(244, 131, 66)
drawingFactor.begin_fill()
drawingFactor.pendown()
drawingFactor.goto(-10,200)
drawingFactor.goto(ceiling1)
drawingFactor.goto(ceiling)
drawingFactor.end_fill()
drawingFactor.setheading(90)


def doors(drawingFactor,io,qq):
drawingFactor.penup()
drawingFactor.goto(io,qq)
drawingFactor.fillcolor(180,0,0)
drawingFactor.begin_fill()
drawingFactor.setheading(90)

for io in range(2):
drawingFactor.forward(50)
drawingFactor.right(90)
drawingFactor.forward(30)
drawingFactor.right(90)

drawingFactor.end_fill()

drawingFactor.fillcolor("yellow")
drawingFactor.penup()
drawingFactor.goto(io,qq+20)
drawingFactor.begin_fill()
drawingFactor.circle(4)
drawingFactor.end_fill()


def windows(drawingFactor,io,qq,shape):
drawingFactor.width(4)
drawingFactor.color("black")
drawingFactor.fillcolor("lightblue")
  
if shape=="square":
drawingFactor.penup()
drawingFactor.goto(io,qq)
drawingFactor.pendown()
drawingFactor.begin_fill()

  
for qq in range(4):
for io in range(4):
drawingFactor.forward(20)
drawingFactor.right(90)
drawingFactor.left(90)
drawingFactor.end_fill()
else:
drawingFactor.penup()
drawingFactor.goto(io,qq)
drawingFactor.pendown()
drawingFactor.backward(20)
drawingFactor.right(90)
drawingFactor.begin_fill()
drawingFactor.circle(20)
drawingFactor.end_fill()
drawingFactor.goto(io,qq)
  
for io in range(2):
drawingFactor.forward(20)
drawingFactor.backward(40)
drawingFactor.forward(20)
drawingFactor.right(90)

main.py

import turtle
from shapes import *

drawingFactor = turtle.Turtle()
drawingFactor.speed(100)
drawingFactor.color(0,0,0)
sc = turtle.Screen()
sc.bgcolor(66,202,244)

windows(drawingFactor,-95,15,"square")
housing(drawingFactor)
doors(drawingFactor,-25,-20)
windows(drawingFactor,-10,100,"circle")
HousingFences(drawingFactor)
windows(drawingFactor,-95,100,"square")
windows(drawingFactor,75,15,"square")
sunImage(drawingFactor,-200,160,70)
windows(drawingFactor,70,100,"square")

Output:

Indentations:

drawingFactor.end fill () drawingFactor.penup () drawingFactor.goto (ceiling) drawingFactor.fillcolor (244, drawingFactor.beg

Rate an upvote....Thankyou

Hope this helps.....

Add a comment
Know the answer?
Add Answer to:
Phython 3 Assignment. Write a graphics program to display (draw) a simple house using at least...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • his assignment will help the student by: Create shapes using Java code Using and creating colors...

    his assignment will help the student by: Create shapes using Java code Using and creating colors with Java Coding JFrames and using the Graphics g method Using Loops (to draw) Your program will generate a drawing using java. You should draw an object that makes sense, not just spare shapes and colors. You must use at least 3 different shapes You must use at least 2 different fonts You must use at least 2 predefined java colors and one custom-made...

  • Your graphics assignment is to write a program for windows forms in C#. C# Program. That...

    Your graphics assignment is to write a program for windows forms in C#. C# Program. That will draw a red circle in the middle of the screen. I also need to know how to set up the form. Please and thank you.

  • Please use JAVA Create an additional drawing panel at least 400 x 400. On it, draw...

    Please use JAVA Create an additional drawing panel at least 400 x 400. On it, draw filled-in shapes of at least two types (rectangles, circles, etc.) in at least two colors. Each shape type should be drawn by its own method (that you write) with parameters indicating where it is to be drawn and how big it is to be. Consider including the color as a parameter as well; this would make the function more flexible. Draw at least ten...

  • 2) Write a Python program that draw simple lollipop (a line and few circles, the line should atta...

    2) Write a Python program that draw simple lollipop (a line and few circles, the line should attach to the circles, just as regular lollipop, you decide the colors), just as we make a "dart" for assignment. You can use the same idea when we make "target" by making few circles with different colors, and using mouse click get 2 points to draw a line. See sample program from Zelle textbook, chapter 4, click.pyw and triangle.pyw. Or see assignment archery.pyw....

  • Please use JAVA Create an additional drawing panel at least 400 x 400. On it, draw filled-in shap...

    Please use JAVA Create an additional drawing panel at least 400 x 400. On it, draw filled-in shapes of at least two types (rectangles, circles, etc.) in at least two colors. Each shape type should be drawn by its own method (that you write) with parameters indicating where it is to be drawn and how big it is to be. Consider including the color as a parameter as well; this would make the function more flexible. Draw at least ten...

  • I need help with my assignment. It is a java program. Please make it as simple...

    I need help with my assignment. It is a java program. Please make it as simple as you can. Create an ArrayList with elements the objects of previous class. Using a simple loop populate the ArrayList with data from some arrays with data, or from console. Use a loop with iterator and write the information in a File using PrintWriter. Use this address for the file (c:\\result\\MyData.txt). Use the Scanner class to display the content of the file on console.

  • Please write this program as simple as possible and use comments throughout to explain what is...

    Please write this program as simple as possible and use comments throughout to explain what is happening. Thank you! Exercise 1: Work programming exercise 4.1, page 150. Name it Pentagon, Run the program with different input values. Document the code and follow the output model shown in the sample run in the textbook (limit the precision of the result to two digits to the rnight of the decimal point)

  • Hi, Hi, I need someone to write a program in Phython 3.6, and please I will...

    Hi, Hi, I need someone to write a program in Phython 3.6, and please I will appreciate if the code is error free and indented correctly. The output would be preferable. thanks Write a GUI program that translates the Latin words to English. The window should have three buttons, one for each Latin word. When the user clicks a button, the program displays the English translation in a label. 3. Miles Per Gallon Calculator Write a GUI program that calculates...

  • Java program GCompound Practice Exercise CS141 Assignment Write a class that represents a digital snowman. Your...

    Java program GCompound Practice Exercise CS141 Assignment Write a class that represents a digital snowman. Your class should follow these guidelines: 1. Store the following private class variables bodyColor of type Color b. int x, int y for the upper left corner Graphics g. a. C. 2. Create two different constructor methods a. A (int x, int y, Graphics myG) parameter constructor that makes the snowman a light gray color by default and makes x and y the upper left...

  • I need help with turtle graphics assignment in python 3, please! Write a program named Lastname_firstname_clock.py to display a clock face with hands showing the current time. The radius of the clock...

    I need help with turtle graphics assignment in python 3, please! Write a program named Lastname_firstname_clock.py to display a clock face with hands showing the current time. The radius of the clock face (the distance from the center to the hour markers) is 150. The hour hand has length 100, and the minute hand has a length of 120 You may design the clock in one of three ways: using the square cursor shape (hint: stamp)) for the hour markers...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT