Hi guys i was wondering how in python you invert this line as I have indicated. I have tried all sorts of mathemtical functions. I am using zelle graphics module. Currnetly I have produced lines going in one direction im trying to produce the same lines again but in the other direction i am sure its just a logical solution. Any help would be most appreciated. Thanks.
from graphics import *
def main():
colour = raw_input("Enter the patch colour: ")
win = GraphWin("Patch", 200, 200)
drawPatch(win, 50, 50, colour)
def drawPatch(win, x, y, colour):
for i in range(5):
for j in range(5):
if (i + j) % 2 == 0:
topLeftX = x + i * 20
topLeftY = y + j * 20
topRightX = x + i * 20 #how to invert lines so they cross
topRightY = y + j * 20
line1 = Line(Point(topLeftX, topLeftY),
Point(topLeftX + 20, topLeftY + 20))
line1.setFill(colour)
line1.draw(win)
#Next Lines accross
line2 = Line(Point(topRightX, topRightY),
Point(topRightX + 20, topRightY + 20))
line2.setFill(colour)
line2.draw(win)
main()