파이썬 같은카드찾기게임 질문
from tkinter import *
root = Tk()
count = 0
def change_card_1():
global count
if(count<2):
count = count + 1
image_1 = Label(root, image= photo_17)
image_1.grid(row=0, column=0)
def change_card_2():
global count
if(count<2):
count = count + 1
image_2 = Label(root, image= photo_18)
image_2.grid(row=0, column=1)
def change_card_3():
global count
if(count<2):
count = count + 1
image_3 = Label(root, image= photo_19)
image_3.grid(row=0, column=2)
def change_card_4():
global count
if(count<2):
count = count + 1
image_4 = Label(root, image= photo_20)
image_4.grid(row=0, column=3)
def change_card_5():
global count
if(count<2):
count = count + 1
image_5 = Label(root, image= photo_21)
image_5.grid(row=1, column=0)
def change_card_6():
global count
if(count<2):
count = count + 1
image_6 = Label(root, image= photo_22)
image_6.grid(row=1, column=1)
def change_card_7():
global count
if(count<2):
count = count + 1
image_7 = Label(root, image= photo_23)
image_7.grid(row=1, column=2)
def change_card_8():
global count
if(count<2):
count = count + 1
image_8 = Label(root, image= photo_24)
image_8.grid(row=1, column=3)
def change_card_9():
global count
if(count<2):
count = count + 1
image_9 = Label(root, image= photo_17)
image_9.grid(row=2, column=0)
def change_card_10():
global count
if(count<2):
count = count + 1
image_10 = Label(root, image= photo_18)
image_10.grid(row=2, column=1)
def change_card_11():
global count
if(count<2):
count = count + 1
image_11 = Label(root, image= photo_19)
image_11.grid(row=2, column=2)
def change_card_12():
global count
if(count<2):
count = count + 1
image_12 = Label(root, image= photo_20)
image_12.grid(row=2, column=3)
def change_card_13():
global count
if(count<2):
count = count + 1
image_13 = Label(root, image= photo_21)
image_13.grid(row=3, column=0)
def change_card_14():
global count
if(count<2):
count = count + 1
image_14 = Label(root, image= photo_22)
image_14.grid(row=3, column=1)
def change_card_15():
global count
if(count<2):
count = count + 1
image_15 = Label(root, image= photo_23)
image_15.grid(row=3, column=2)
def change_card_16():
global count
if(count<2):
count = count + 1
image_16 = Label(root, image= photo_24)
image_16.grid(row=3, column=3)
photo_1 = PhotoImage(file = "back.gif")
image_1 = Button(root, image= photo_1, command=change_card_1)
image_1.grid(row=0, column=0)
photo_2 = PhotoImage(file = "back.gif")
image_2 = Button(root, image= photo_2, command=change_card_2)
image_2.grid(row=0, column=1)
photo_3 = PhotoImage(file = "back.gif")
image_3 = Button(root, image= photo_3, command=change_card_3)
image_3.grid(row=0, column=2)
photo_4 = PhotoImage(file = "back.gif")
image_4 = Button(root, image= photo_4, command=change_card_4)
image_4.grid(row=0, column=3)
photo_5 = PhotoImage(file = "back.gif")
image_5 = Button(root, image= photo_5, command=change_card_5)
image_5.grid(row=1, column=0)
photo_6 = PhotoImage(file = "back.gif")
image_6 = Button(root, image= photo_6, command=change_card_6)
image_6.grid(row=1, column=1)
photo_7 = PhotoImage(file = "back.gif")
image_7 = Button(root, image= photo_7, command=change_card_7)
image_7.grid(row=1, column=2)
photo_8 = PhotoImage(file = "back.gif")
image_8 = Button(root, image= photo_8, command=change_card_8)
image_8.grid(row=1, column=3)
photo_9 = PhotoImage(file = "back.gif")
image_9 = Button(root, image= photo_9, command=change_card_9)
image_9.grid(row=2, column=0)
photo_10 = PhotoImage(file = "back.gif")
image_10 = Button(root, image= photo_10, command=change_card_10)
image_10.grid(row=2, column=1)
photo_11 = PhotoImage(file = "back.gif")
image_11 = Button(root, image= photo_11, command=change_card_11)
image_11.grid(row=2, column=2)
photo_12 = PhotoImage(file = "back.gif")
image_12 = Button(root, image= photo_12, command=change_card_12)
image_12.grid(row=2, column=3)
photo_13 = PhotoImage(file = "back.gif")
image_13 = Button(root, image= photo_13, command=change_card_13)
image_13.grid(row=3, column=0)
photo_14 = PhotoImage(file = "back.gif")
image_14 = Button(root, image= photo_14, command=change_card_14)
image_14.grid(row=3, column=1)
photo_15 = PhotoImage(file = "back.gif")
image_15 = Button(root, image= photo_15, command=change_card_15)
image_15.grid(row=3, column=2)
photo_16 = PhotoImage(file = "back.gif")
image_16 = Button(root, image=photo_16, command=change_card_16)
image_16.grid(row=3, column=3)
photo_17 = PhotoImage(file = "nether.gif")
photo_18 = PhotoImage(file = "burk.gif")
photo_19 = PhotoImage(file = "austria.gif")
photo_20 = PhotoImage(file = "aa.gif")
photo_21 = PhotoImage(file = "denmark.gif")
photo_22 = PhotoImage(file = "espa.gif")
photo_23 = PhotoImage(file = "hung.gif")
photo_24 = PhotoImage(file = "ice.gif")
root.mainloop()
파이썬으로 같은카드찾기게임을 만드는데요..
이미지를 삽입하고 이미지 비교후 맞는지 여부에따라 맞으면 그대로 두고 틀리면 다시 뒤집는 방식으로 만들려고 하는데, 어떻게 해야할지 모르겠습니다... 도와주세요 ㅠㅠ..
python 에서는 indentation 중요합니다.
python 에서는 indentation 중요합니다.
code 태그 안에 소스를 넣어서 질문해 보셔요.
세벌 https://sebuls.blogspot.kr/
댓글 달기