I want to create this shape but with a loop so it shortens down my code. This is using the Graphics.py module
Can anyone help pls
from graphics import *
def drawPatchLines():
win = GraphWin("Window",100,100)
win.setBackground('white')
#Draws the white rectangle in top left
rect = Rectangle(Point(0,0), Point(100,100))
rect.setOutline('black')
rect.setFill('white')
rect.draw(win)
#Draws the red lines
poly = Polygon (Point(0,100), Point(10,100), Point(10,90), Point(0,90))
poly.setFill('red')
poly.setOutline('red')
poly.draw(win)
poly1 = Polygon (Point(20,100), Point(30,100), Point(30,70), Point(0,70), Point(0,80), Point(20,80))
poly1.setFill('red')
poly1.setOutline('red')
poly1.draw(win)
poly2 = Polygon (Point(40,100), Point(50,100), Point(50,50), Point(0,50), Point(0,60), Point(40,60))
poly2.setFill('red')
poly2.setOutline('red')
poly2.draw(win)
poly3 = Polygon (Point(60,100), Point(70,100), Point(70,30), Point(0,30), Point(0,40), Point(60,40))
poly3.setFill('red')
poly3.setOutline('red')
poly3.draw(win)
poly4 = Polygon (Point(80,100), Point(90,100), Point(90,10), Point(0,10), Point(0,20), Point(80,20))
poly4.setFill('red')
poly4.setOutline('red')
poly4.draw(win)