forked from sangwonKimDS/Hello-World---Hard
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmatgoview.py
258 lines (246 loc) · 7.95 KB
/
matgoview.py
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
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
import random
import tkinter as tk
from tkinter import *
"""
View class
"""
# View class
class Reader:
@staticmethod
def go(a):
push_window = Toplevel(a)
push_window.title("선택")
push_label = Label(push_window,text ="고?")
push_label.pack()
def yes():
global b
b = True
push_window.destroy()
push_window.quit()
def no():
global b
b = False
push_window.destroy()
push_window.quit()
push_yes = Button(push_window,text = "yes",command = yes)
push_yes.pack()
push_no = Button(push_window,text = "no",command = no)
push_no.pack()
push_window.mainloop()
return b
@staticmethod
def push(a):
push_window = Toplevel(a)
push_window.title("선택")
push_label = Label(push_window,text ="밀기 하시겠습니까?")
push_label.pack()
def yes():
global b
b = True
push_window.destroy()
push_window.quit()
def no():
global b
b = False
push_window.destroy()
push_window.quit()
push_yes = Button(push_window,text = "yes",command = yes)
push_yes.pack()
push_no = Button(push_window,text = "no",command = no)
push_no.pack()
push_window.mainloop()
return b
@staticmethod
def shake(a):
push_window = Toplevel(a)
push_window.title("선택")
push_label = Label(push_window,text ="흔들겠습니까?")
push_label.pack()
def yes():
global b
b = True
push_window.destroy()
push_window.quit()
def no():
global b
b = False
push_window.destroy()
push_window.quit()
push_yes = Button(push_window,text = "yes",command = yes)
push_yes.pack()
push_no = Button(push_window,text = "no",command = no)
push_no.pack()
push_window.mainloop()
return b
@staticmethod
def choose(a):
push_window = Toplevel(a)
push_window.title("선택")
push_label = Label(push_window,text ="쌍피열끗 중 무엇을 얻으시겠습니까?")
push_label.pack()
def yes():
global b
b = True
push_window.destroy()
push_window.quit()
def no():
global b
b= False
push_window.destroy()
push_window.quit()
push_yes = Button(push_window,text = "열끗",command = yes)
push_yes.pack()
push_no = Button(push_window,text = "쌍피",command = no)
push_no.pack()
push_window.mainloop()
return b
@staticmethod
def cardchoose(number,a, field, hand):
choose_btn = ['','','','','','','','','','']
def selectnum0():
global b
b = 0
delete()
a.quit()
def selectnum1():
global b
b = 1
delete()
a.quit()
def selectnum2():
global b
b = 2
delete()
a.quit()
def selectnum3():
global b
b = 3
delete()
a.quit()
def selectnum4():
global b
b = 4
delete()
a.quit()
def selectnum5():
global b
b = 5
delete()
a.quit()
def selectnum6():
global b
b = 6
delete()
a.quit()
def selectnum7():
global b
b = 7
delete()
a.quit()
def selectnum8():
global b
b = 8
delete()
a.quit()
def selectnum9():
global b
b = 9
delete()
a.quit()
def delete():
for i in range(len(number)):
choose_btn[i].grid_forget()
def check(card, field):
flag=False
for i in field:
for k in i:
if k.month==card.month:
flag=True
return flag
if(len(hand)>=1):
if(check(hand[0], field)):
choose_btn[0] = Button(a,text = "!",command = selectnum0)
else:
choose_btn[0] = Button(a,text = "?",command = selectnum0)
if(len(hand)>=2):
if(check(hand[1], field)):
choose_btn[1] = Button(a,text = "!",command = selectnum1)
else:
choose_btn[1] = Button(a,text = "?",command = selectnum1)
if(len(hand)>=3):
if(check(hand[2], field)):
choose_btn[2] = Button(a,text = "!",command = selectnum2)
else:
choose_btn[2] = Button(a,text = "?",command = selectnum2)
if(len(hand)>=4):
if(check(hand[3], field)):
choose_btn[3] = Button(a,text = "!",command = selectnum3)
else:
choose_btn[3] = Button(a,text = "?",command = selectnum3)
if(len(hand)>=5):
if(check(hand[4], field)):
choose_btn[4] = Button(a,text = "!",command = selectnum4)
else:
choose_btn[4] = Button(a,text = "?",command = selectnum4)
if(len(hand)>=6):
if(check(hand[5], field)):
choose_btn[5] = Button(a,text = "!",command = selectnum5)
else:
choose_btn[5] = Button(a,text = "?",command = selectnum5)
if(len(hand)>=7):
if(check(hand[6], field)):
choose_btn[6] = Button(a,text = "!",command = selectnum6)
else:
choose_btn[6] = Button(a,text = "?",command = selectnum6)
if(len(hand)>=8):
if(check(hand[7], field)):
choose_btn[7] = Button(a,text = "!",command = selectnum7)
else:
choose_btn[7] = Button(a,text = "?",command = selectnum7)
if(len(hand)>=9):
if(check(hand[8], field)):
choose_btn[8] = Button(a,text = "!",command = selectnum8)
else:
choose_btn[8] = Button(a,text = "?",command = selectnum8)
if(len(hand)>=10):
if(check(hand[9], field)):
choose_btn[9] = Button(a,text = "!",command = selectnum9)
else:
choose_btn[9] = Button(a,text = "?",command = selectnum9)
for i in range(len(number)):
if 0<=i<5:
choose_btn[i].place(x=476+(i)*40,y=325)
else:
choose_btn[i].place(x=476+(i-5)*40,y=395)
a.mainloop()
return int(b+1)
@staticmethod
def card_choose(obj,a,b):
if obj.name=="Computer":
return random.randrange(2)
else :
push_window = Toplevel()
push_window.title("선택")
card1_image = PhotoImage(file = "./img_matgo/"+a.img)
card1 = Label(push_window,image = card1_image)
Label(push_window, text=" ").grid(row=1, column=0)
card1.grid(row= 1, column = 1 )
card2_image = PhotoImage(file = "./img_matgo/"+b.img)
card2 = Label(push_window,image = card2_image)
card2.grid(row = 1, column =2)
def yes():
global c
c = 0
push_window.destroy()
push_window.quit()
def no():
global c
c= 1
push_window.destroy()
push_window.quit()
push_yes = Button(push_window,text = "선택",command = yes)
push_yes.grid(row = 2, column = 1)
push_no = Button(push_window,text = "선택",command = no)
push_no.grid(row = 2, column = 2)
push_window.mainloop()
return int(c)