def savegame(): global game_state log('savegame function') save_and_load.encode_and_save(username, game_state) toplevel = Toplevel() msg = Message(toplevel, text="Game saved!") msg.pack()
def createaccount(login_frame, uname): global game_state, username username = uname login_frame.destroy() game_state = game_model.GameState() try: save_and_load.encode_and_save(username, game_state) main() except IOError as ioe: log(ioe)
def resetgame(): log('resetgame invoked') toplevel = Toplevel() msg = Label(toplevel, text="Are you sure you want to reset?") msg.grid(row=0, column=0, columnspan=2) yesbutton = Button(toplevel, text="Yes", command=lambda: save_and_load.encode_and_save(username, game_state)) yesbutton.grid(row=1, column=0) nobutton = Button(toplevel, text="No", command=toplevel.destroy) nobutton.grid(row=1, column=1)
def resetgame(): log('resetgame invoked') toplevel = Toplevel() msg = Label(toplevel, text="Are you sure you want to reset?") msg.grid(row=0, column=0, columnspan=2) yesbutton = Button( toplevel, text="Yes", command=lambda: save_and_load.encode_and_save(username, game_state)) yesbutton.grid(row=1, column=0) nobutton = Button(toplevel, text="No", command=toplevel.destroy) nobutton.grid(row=1, column=1)