I want it to have a different picture for each coordinate. Right now all it is doing is picking the first set of coordinates and then it puts each picture in the list at the coordinate then goes to the next coordinate resulting in the same picture at each coordinate.

I've tried to rearrange the order of the loops but that isn't working.

def drawPicture(img, x, y, win):
    picture = Image(Point(x,y), img)
    picture.draw(win)

#create lists for cards
pictureNamesList = ["0.gif", "1.gif", "2.gif", "3.gif", "4.gif", "5.gif", "6.gif", "7.gif", "0.gif", "1.gif", "2.gif", "3.gif", "4.gif", "5.gif", "6.gif", "7.gif"]
random.shuffle(pictureNamesList)

#draw cards and their backs
cardsX = [375, 475, 575, 675]
cardsY = [100, 200, 300, 400]

for x in range(4):
    for y in range(4):
        for pic in range(16)
            drawPicture(pictureNamesList[pic], int(cardsX[x]), int(cardsY[y]), win)

1 Answers

0
Colin On Best Solutions
for x in range(4):
    for y in range(4):
        drawPicture(pictureNamesList[x*4+y], int(cardsX[x]), int(cardsY[y]), win)