Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

use python 3 only draw the upper right one , need an example to help me, please. 1. Function to draw a row Your first

image text in transcribed

image text in transcribeduse python 3 only draw the upper right one , need an example to help me, please.

1. Function to draw a row Your first function should draw a single row. Notice that we specify each row in terms of how many pairs of black/white boxes it has. Your function doesn't have to be able to produce a row that has a different number of black versus white boxes. The boxes are specified using a single size measure because each should be a square. Different rows have different sizes, positions, and so on. Therefore, your function should accept several parameters so that it is possible to call it many times to draw the many different rows on the screen. 2. Function to draw a grid Once you have completed the function that produces one row, write another function that produces a grid of rows. Grids are composed of a series of pairs of rows where the second row is offset a certain distance in the x direction relative to the first. Each grid is a square, which is why a single value (number of pairs) indicates the number of rows and columns. A single box size is again used because each box should be a square. The offset indicates how far the second row should be shifted to the right in each pair. The figure in the lower-left has no offset at all. The grid in the upper-right is offset by the size of one of the boxes, which is why it has a checkerboard appearance. The other two grids have an offset that is in between, which is why they produce the optical illusion. Each pair of lines in the grid should be separated by a certain distance, revealing the gray background underneath. This is referred to as the "mortar" that would appear between layers of brick if you were to build a wall with this pattern. The mortar is essential to the illusion. Your program should use 2 pixels of separation for the mortar, but you should introduce a program constant that would make it easy to change this value to something else Place the following statement at the top of your Python files, so that your code can use graphics from DrawingPanel import* # so that I can use Graphics 1. Function to draw a row Your first function should draw a single row. Notice that we specify each row in terms of how many pairs of black/white boxes it has. Your function doesn't have to be able to produce a row that has a different number of black versus white boxes. The boxes are specified using a single size measure because each should be a square. Different rows have different sizes, positions, and so on. Therefore, your function should accept several parameters so that it is possible to call it many times to draw the many different rows on the screen. 2. Function to draw a grid Once you have completed the function that produces one row, write another function that produces a grid of rows. Grids are composed of a series of pairs of rows where the second row is offset a certain distance in the x direction relative to the first. Each grid is a square, which is why a single value (number of pairs) indicates the number of rows and columns. A single box size is again used because each box should be a square. The offset indicates how far the second row should be shifted to the right in each pair. The figure in the lower-left has no offset at all. The grid in the upper-right is offset by the size of one of the boxes, which is why it has a checkerboard appearance. The other two grids have an offset that is in between, which is why they produce the optical illusion. Each pair of lines in the grid should be separated by a certain distance, revealing the gray background underneath. This is referred to as the "mortar" that would appear between layers of brick if you were to build a wall with this pattern. The mortar is essential to the illusion. Your program should use 2 pixels of separation for the mortar, but you should introduce a program constant that would make it easy to change this value to something else Place the following statement at the top of your Python files, so that your code can use graphics from DrawingPanel import* # so that I can use Graphics

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Logidata+ Deductive Databases With Complex Objects Lncs 701

Authors: Paolo Atzeni

1st Edition

354056974X, 978-3540569749

More Books

Students also viewed these Databases questions

Question

differentiate the function ( x + 1 ) / ( x ^ 3 + x - 6 )

Answered: 1 week ago