def main(): data = Data([1, 2, 3, 4, 5], "lol") print(data) storage = Storage() storage.add(data) storage.add(Data([1, 2, 3, 4, 5], "kek")) print(storage.getAll())
def initValues(self): try: self.validator.size(self.widthEntry.get(), self.heightEntry.get(), self.minesEntry.get()) except Exception as exc: self.widthEntry.delete(0, 'end') self.heightEntry.delete(0, 'end') self.minesEntry.delete(0, 'end') messagebox.showerror("Error", str(exc.getValue())) else: self.width = int(self.widthEntry.get()) self.height = int(self.widthEntry.get()) self.mines = int(self.minesEntry.get()) storage = Storage() storage.add("mines", self.mines) storage.add("height", self.height) storage.add("width", self.width) print("Save in storage")
self.tilesAmount -= 1 self.checkTilesAmount() def checkTilesAmount(self): if self.tilesAmount == self.mines: self.gameOver("wygrałeś") def newPrediction(self, bomb): self.bombsPrediction.add(bomb) newSet = self.bombs - self.bombsPrediction if not len(newSet): self.gameOver("wygrałeś") def gameOver(self, text): self.timer.stop() self.showAll() messagebox.showerror("koniec Gry", text) if __name__ == "__main__": storage = Storage() storage.add("mines", 3) storage.add("height", 20) storage.add("width", 20) root = Tk() game = Game(root) game.initGameCallBack() root.mainloop()