Hey i'm trying to draw this patch in python 3.2. As you can see I can get it to draw the top row, but I cannot get it to truncate the rectangles at the left and right hand side, and I cannot get it to repeat itself...
Please Help :)!
from graphics import *
def drawPatch2():
win = GraphWin("Patch 2", 500, 500)
x = 100
y = 100
colour = "red"
for i in range(5):
for j in range(11):
if j % 2 == 0:
topLeftX = x + j * 10
topLeftY = y
rectangle = Rectangle(Point(topLeftX, topLeftY),
Point(topLeftX + 10, topLeftY + 10))
rectangle.setFill(colour)
rectangle.draw(win)
else:
topLeftX = x + j * 10
topLeftY = y
rectangle = Rectangle(Point(topLeftX, topLeftY),
Point(topLeftX + 10, topLeftY + 10))
rectangle.draw(win)
if row%2:
points_list = [ 0, points_list[1]+25, 25, points_list[3]+25]
else:
points_list = [25, points_list[1]+25, 50, points_list[3]+25]
for k in range(5):
topLeftX = x + k * 20
topLeftY = y
rectangle = Rectangle(Point(topLeftX, topLeftY),
Point(topLeftX + 20, topLeftY + 20))
rectangle.draw(win)