I've tried to get this to work, but it just freezes.
It should display a pyramid, but all it does is.. halts.
from graphics import *
valid_colours = ['red', 'blue', 'yellow', 'green']
colour = ['', '', '']
while True:
colour[0] = raw_input("Enter your first colour: ")
colour[1] = raw_input("Enter your second colour: ")
colour[2] = raw_input("Enter your third colour: ")
if ((colour[0] and colour[1] and colour[2]) in valid_colours):
break
while True:
width = raw_input("Enter a width between 2-7: ")
if width.isdigit():
if (int(width) <= 7 and int(width) >= 2):
break
width = int(width)
win = GraphWin("My Mini Project ", 1000, 1000) # 1000 \ 20 = 50
win.setCoords(0 , 0 , 20, 20)
p1 = [0, 2]
while width > 0:
p = [1, 3]
loopWidth = 0
while loopWidth < width:
loopWidth = loopWidth + 1
c = 0
while c <= 10:
c = c + 1
if c % 2:
colour = "white"
else:
colour = "red"
rectangle = Rectangle(Point(p[0],p1[0]), Point(p[1], p1[1]))
rectangle.setFill(colour)
rectangle.setOutline("black")
rectangle.draw(win)
p[0] = p[0] + 0.2
p1[0] = p1[0] + 0.2
p[0] = p[0] - 2
p1[0] = p1[0] - 2
p[0] = p[0] + 2
p[1] = p[1] + 2
width = width - 1
p1[0] = p1[0] + 2
p1[1] = p1[1] + 2