示例#1
0
 def ten(self):
     with open(self.path_customers + self.login, 'r') as file:
         lines = file.readlines()
     if float(lines[3]) < 1000:
         messagebox.showerror('error', 'No funds')
     elif float(lines[3]) > 1000:
         with open(self.path_customers + self.login, 'w') as file2:
             lines[3] = str(float(lines[3]) - 1000.0) + '\n'
             for x in lines:
                 file2.write(x)
             self.t = lotto(self, self.login)
             self.b = self.t.but
             self.b.configure(command=self.t.ten_try)
             self.t
             self.withdraw()
             bank_acc(self.path_bank, 1000)
示例#2
0
 def check(self):
     self.number = random.randint(1, 2)
     self.bet_score = float(self.entry.get())
     with open(self.path_customers + self.login, "r") as file:
         lines = file.readlines()
         if float(lines[3]) < self.bet_score:
             messagebox.showerror('error', 'no funds')
         else:
             if self.number == 1:
                 with open(self.path_customers + self.login, "w") as file2:
                     for x in lines:
                         file2.write(x)
                     messagebox.showinfo(
                         'great',
                         'You won: ' + str(round(self.bet_score / 5)))
             else:
                 with open(self.path_customers + self.login, "w") as file2:
                     lines[3] = str(float(lines[3]) - self.bet_score) + '\n'
                     for x in lines:
                         file2.write(x)
                     messagebox.showinfo('loose', "you lost")
             bank_acc(self.path_bank, self.bet_score)