Hi i am trying to create a function that asks the user to enter height and width then colour to then display each pattern in the selected colours.
i made a start but i cant make it work with the colour nor adding size dimensions.
# mini_project.py
from graphics import*
def main():
height = getHeight()
width = getWidth()
Colours = Colours()
drawPatchwork(height, width, Colours)
drawPatchOne(win, 5, 5, colour)
drawPatchTwo(win, 5, 5, colour)
def getHeight():
patchDimensions = range(3,8)
height = 0
while height not in patchDimensions:
print "Please enter the patch height vaule: "
height = input ("Enter height dimension: ")
if height not in patchDimensions:
print "Re-enter as an integer. "
return height
def getWidth():
patchDimensions = range(3,8)
width = 0
while width not in patchDimensions:
print "Please enter the patch width vaule: "
width = input ("Enter width dimension: ")
if width not in patchDimensions:
print "Re-enter vaule as an integer. "
return width
def Colours():
Colours = []
while len(Colours)< 3:
print "Please pick a colour vaule"
colour = raw_input("Colour?")
if colours not in Colour:
Colours.append(colour)
else:
print "Colour already has been choosen. "
print "Make another choice."
return Colours
def drawPatchOne(win, Colours, y):
y = 51
centre = Point(51.47,y)
radius = 50
patch1 = Circle(centre, radius)
patch1.draw(win)
for i in range(10):
radius = radius - 5
y = y + 5
centre = Point(50,y)
patch1 = Circle(centre, radius)
#patch1.setFill(colour)
patch1.draw(win)
main()