오류는 없다는데 버튼 눌러서 실행이 안됨
이유가 뭔지 알고싶음...
from tkinter import *
import random
window=Tk()game=["가위","바위","보"]def process():
while True:
gamer=random.choice(game)
you=(game)
a=random.choice(game)
b=random.choice(game)
y=Label(window,text=a)
g=Label(window,text=b)
y.place(x=20,y=20)
g.place(x=80,y=20)
c=0
if (you=='가위' and gamer=='바위')or(you=='바위'and gamer=='보')or(you=='보'and gamer=='가위'):
self.depositLabel.config(text='패')
elif (you=='가위' and gamer=='보')or(you=='바위'and gamer=='가위')or(you=='보'and gamer=='바위'):
self.depositLabel.config(text='승')
c+=1
elif you==gamer:
self.depositLabel.config(text='무')
if c==3:
break
button=Button(window,text='Game start',command=process)
button.pack()
window.mainloop()
이유가 뭔지 알고싶음...
from tkinter import *
import random
window=Tk()game=["가위","바위","보"]def process():
while True:
gamer=random.choice(game)
you=(game)
a=random.choice(game)
b=random.choice(game)
y=Label(window,text=a)
g=Label(window,text=b)
y.place(x=20,y=20)
g.place(x=80,y=20)
c=0
if (you=='가위' and gamer=='바위')or(you=='바위'and gamer=='보')or(you=='보'and gamer=='가위'):
self.depositLabel.config(text='패')
elif (you=='가위' and gamer=='보')or(you=='바위'and gamer=='가위')or(you=='보'and gamer=='바위'):
self.depositLabel.config(text='승')
c+=1
elif you==gamer:
self.depositLabel.config(text='무')
if c==3:
break
button=Button(window,text='Game start',command=process)
button.pack()
window.mainloop()
무한루프 돈다 뭔가 로직이 이상한데
self.depositLabel.config(text='패') 이부분이 이상해서 break가 안걸리는건가
c=0을 while밖으로 빼야지