![](/img/trans.png)
[英]Is there a way to create a loop logic that can select different option for each dropdown list and repeat it again for the next option?
[英]Is there a way to have a different list element for each loop?
我希望每個坐標都有不同的圖片。 現在它所做的只是選擇第一組坐標,然后將每張圖片放在坐標列表中,然后轉到下一個坐標,在每個坐標處產生相同的圖片。
我試圖重新排列循環的順序,但這是行不通的。
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)
for x in range(4):
for y in range(4):
drawPicture(pictureNamesList[x*4+y], int(cardsX[x]), int(cardsY[y]), win)
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.