Browse Source

3.141592653589

master
BARRAUX Arthur 3 years ago
parent
commit
c9760cd8b3
  1. 14
      main_tk.py

14
main_tk.py

@ -12,10 +12,12 @@ class Machine_a_sous:
def saisie(self):
"""demande à l'utilisateur une mise"""
print('saisie')
if not 100 > self.mise >= 0 or not self.mise <= self.argent: # tant que mise n'est pas compris entre 0-100 et > mise
return False
if self.mise > self.argent or self.mise == 0:
return "quit"
else:
self.bank += self.mise
self.argent -= self.mise
return self.mise
@ -26,6 +28,9 @@ class Machine_a_sous:
return self.nombres
def gain(self):
print('hello')
print(self.mise, self.argent, self.bank)
print(self.nombres)
if len(set(self.nombres)) == 1 and 9 in self.nombres:
self.gains = self.bank + self.mise
self.argent += self.gains
@ -51,7 +56,6 @@ class Machine_a_sous:
class Game_gui:
def __init__(self):
self.bg_color = '#777777'
self.fen = tk.Tk()
self.fen.geometry('900x600')
self.fen.title('Bellagio')
@ -82,14 +86,16 @@ class Game_gui:
def play(self, event):
machine.mise = int(self.entry_mise.get())
if machine.saisie() == "quit":
mise_state = machine.saisie()
if mise_state == "quit":
self.fen.quit()
elif machine.saisie() != False:
elif mise_state != False:
machine.nbAlea()
machine.gain()
self.name_info = [machine.bank, machine.mise, machine.argent]
print(self.name_info)
self.maj_graph()
if machine.bank <= 500:
if machine.bank <= 500 or machine.argent == 0:
self.fen.destroy()
def maj_graph(self):

Loading…
Cancel
Save