Exemple #1
0
 def save_game(self):
     def _save_game(filename):
         with open(filename, 'wb') as f:
             pickle.dump(self.board, f, protocol=2)
         window.destroy()
     window = self.make_modal_window("Save Game")
     fbox = FileSelectBox(window, command=_save_game)
     fbox.pack()
     window.mainloop()
Exemple #2
0
 def save_game(self):
     def _save_game(filename):
         with open(filename, 'wb') as f:
             pickle.dump(self.board, f, protocol=2)
         window.destroy()
     window = self.make_modal_window("Save Game")
     fbox = FileSelectBox(window, command=_save_game)
     fbox.pack()
     window.mainloop()
Exemple #3
0
 def load_game(self):
     def _load_game(filename):
         with open(filename, 'rb') as f:
             board = pickle.load(f)
             if not isinstance(board, SudokuBoard):
                 # TODO: Report bad file
                 return
             self.board = board
         self.sync_board_and_canvas()
         window.destroy()
     window = self.make_modal_window("Load Game")
     fbox = FileSelectBox(window, command=_load_game)
     fbox.pack()
     window.mainloop()
Exemple #4
0
 def load_game(self):
     def _load_game(filename):
         with open(filename, 'rb') as f:
             board = pickle.load(f)
             if not isinstance(board, Board):
                 # TODO: Report bad file
                 return
             self.board = board
         self.sync_board_and_canvas()
         window.destroy()
     window = self.make_modal_window("Load Game")
     fbox = FileSelectBox(window, command=_load_game)
     fbox.pack()
     window.mainloop()
 def load_game(self):
     def _load_game(filename):
         with open(filename, 'rb') as f:
             board = pickle.load(f)
             if not isinstance(board, SudokuBoard):
                 print ("Invalid File Type Opened")
                 return
             self.board = board
         self.sync_board_and_canvas()
         window.destroy()
     window = self.make_modal_window("Load Game")
     fbox = FileSelectBox(window, command=_load_game)
     fbox.pack()
     window.mainloop()