Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Part B: CafeWall This image has several levels of structure. Black and white squares are used to form rows and rows are combined to form
Part B: CafeWall
This image has several levels of structure. Black and white squares are used to form rows and rows are combined to form grids. The output has two free-standing rows and four grids. The overall drawing panel is size 650 x 400. Its background is grey and the squares are black and white. A blue X covers each black square. The six figures on the grid should have the following properties:
Description | (x, y) position | Number of pairs | Size of each box | 2nd row offset |
upper-left | (0, 0) | 4 | 20 | N/A |
mid-left | (50, 70) | 5 | 30 | N/A |
lower left | (10, 150) | 4 | 25 | 0 |
lower middle | (250, 200) | 3 | 25 | 10 |
lower right | (425, 180) | 5 | 20 | 10 |
upper right | (400, 20) | 2 | 35 | 35 |
Lab2_functions.py
from turtle import * # Draw a line from (x1, y1) to (x2, y2) # Make line color def draw_line(x1, y1, x2, y2, color): # Save current location and state # current_position = pos() pen_state = pen() # Draw line pencolor(color) up() goto(x1, y1) down() goto(x2, y2) up() # Reset position, color, and state # goto(current_position) pen(pen_state) # Draw a draw_rect with the upper left corner at x,y # and with dimensions x_size by y_size. Use color for # background def draw_rect(x, y, x_size, y_size, color): # Save current location and state # current_position = pos() pen_state = pen() # Set rectangle colors fillcolor(color) pencolor(color) # Move Turtle to x,y without drawing a line up() goto(x,y) # Draw the rectangle and fill it down() setheading(90) begin_fill() forward(x_size) right(90) forward(y_size) right(90) forward(x_size) right(90) forward(y_size) end_fill() up() # Reset position, color, and state # goto(current_position) pen(pen_state)
Learner_Template.py
from turtle import * from Lab2_functions import * # set mortar joints between rows MORTAR = 2 def main(): setworldcoordinates(0,400,650,0) clear() shape('turtle') pencolor('olive drab') fillcolor('sienna') bgcolor('grey') #### YOUR CODE GOES HERE ################# ########################################## main()
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started