-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpokerimagenesborrador
136 lines (133 loc) · 4.28 KB
/
pokerimagenesborrador
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
import tkinter
from tkinter import *
import random
def voltearCarta1():
global contgen; si=False
if contgen[0] % 2 != 0:
boton1.configure(image=dicii[listakeys[0]])
si=True
else:
boton1.configure(image=cartaR)
contgen[0] += 1
print("Cont1: ", contgen)
for i in range(6):
for k in range(6):
if si==True and listakeys[i]==listakeys[k]:
esc=boton[i]
esc2=boton[k]
esc["state"]=tkinter.DISABLED
esc2["state"]=tkinter.DISABLED
""" if si==True and listakeys[0]==listakeys[3]:
boton1["state"]=tkinter.DISABLED
boton4["state"]=tkinter.DISABLED
elif si==5 and listakeys[0]
verificar()"""
#verificarpares()
def voltearCarta2():
global contgen
if contgen[1] %2 !=0:
boton2.configure(image= dicii[listakeys[1]])
else:
boton2.configure(image= cartaR)
contgen[1]+=1
print("Cont2: ", contgen)
verificar()
#verificarpares()
def voltearCarta3():
global contgen
if contgen[2] %2 !=0:
boton3.configure(image=dicii[listakeys[2]])
else:
boton3.configure(image=cartaR)
contgen[2]+=1
print("Cont3: ", contgen)
verificar()
#verificarpares()
def voltearCarta4():
global contgen
print("Cont4: ",contgen)
if contgen[3] %2 !=0:
boton4.configure(image=dicii[listakeys[3]])
else:
boton4.configure(image=cartaR)
contgen[3]+=1
print("Cont4: ", contgen)
verificar()
#verificarpares()
def voltearCarta5():
global contgen
if contgen[4] %2 !=0:
boton5.configure(image=dicii[listakeys[4]])
else:
boton5.configure(image=cartaR)
contgen[4]+=1
print("Cont5: ", contgen)
verificar()
#verificarpares()
def voltearCarta6():
global contgen
if contgen[5] %2 !=0:
boton6.configure(image=dicii[listakeys[5]])
else:
boton6.configure(image=cartaR)
contgen[5]+=1
print("Cont6: ", contgen)
verificar()
#verificarpares()
contgen=[1,1,1,1,1,1]
ventana = Tk()
def verificar():
global contgen
n=0
for i in contgen:
if i%2==0:
n+=1
if n==2:
contgen = [1, 1, 1, 1, 1, 1]
boton1.configure(image=cartaR)
boton2.configure(image=cartaR)
boton3.configure(image=cartaR)
boton4.configure(image=cartaR)
boton5.configure(image=cartaR)
boton6.configure(image=cartaR)
def verificarpares():
if dicii[0]==dicii[3]:
boton1["state"]=tkinter.DISABLED
boton4["state"]=tkinter.DISABLED
if dicii[1]==dicii[4]:
boton2["state"]=tkinter.DISABLED
boton5["state"]=tkinter.DISABLED
if dicii[2]==dicii[5]:
boton3["state"]=tkinter.DISABLED
boton6["state"]=tkinter.DISABLED
"""
label1 = Label(ventana, text='Carta1', font= ("Arial bold", 10))
label1.grid(column = 1, row=0)
label1 = Label(ventana, text='Carta1R', font= ("Arial bold", 10))
label1.grid(column = 2, row=0)
Label1=Label(ventana,text="carta2", font=("Arial bold",10))
label1.grid(column=3,row=0)"""
carta9C = PhotoImage(file = r"carta9C.png")
cartaR = PhotoImage(file = r"cartareves.png")
cartaASR=PhotoImage(file=r"cartaASR.png")
cartaJC=PhotoImage(file=r"cartaJC.png")
boton1= Button(ventana,text="Presionar",height=300,width=230,image=cartaR,command=voltearCarta1)
boton1.grid(column=1,row=0)
boton2= Button(ventana,text="Presionar",height=300,width=230,image=cartaR,command=voltearCarta2)
boton2.grid(column=2,row=0)
boton3= Button(ventana,text="Presionar",height=300,width=230,image=cartaR,command=voltearCarta3)
boton3.grid(column=3,row=0)
boton4= Button(ventana,text="Presionar",height=300,width=230,image=cartaR,command=voltearCarta4)
boton4.grid(column=1,row=1)
boton5= Button(ventana,text="Presionar",height=300,width=230,image=cartaR,command=voltearCarta5)
boton5.grid(column=2,row=1)
boton6= Button(ventana,text="Presionar",height=300,width=230,image=cartaR,command=voltearCarta6)
boton6.grid(column=3,row=1)
ventana.title("ENCUENTRA LOS PARES")
ventana.geometry("800x800")
boton=[boton1,boton2,boton3,boton4,boton5,boton6]
dicii={0:cartaJC, 1:cartaASR,2:carta9C,3:cartaJC,4:cartaASR,5:carta9C}
print(dicii[0])
listakeys=[0,1,2,3,4,5]
random.shuffle(listakeys)
ventana.mainloop()