def handaleFile(): global ssb, menu, background_label, trainData, window, traningMenu if (file): new_item.entryconfig(1, state=NORMAL) new_item.entryconfig(2, state=NORMAL) new_item.entryconfig(4, state=NORMAL) menu.entryconfig("Data", state="normal") ssb = ssbu(file) menu.delete(3) if ssb.webdata: img2 = ImageTk.PhotoImage(ssb.img) background_label.configure(image=img2) background_label.image = img2 window.title("SSBU Amiibo editor " + ssb.webdata['amiibo']['name']) for train in training: if training[train]['head'] == ssb.webdata['amiibo']['head']: print(train) trainData = training[train] items = Menu(menu, tearoff=0) for move in trainData['data']: print(" " + move[0]) items.add_command( label=move[0], command=( lambda move: lambda: traningFunc(move))(move)) menu.add_cascade(label='Traning', menu=items) else: window.title("SSBU Amiibo editor [" + ssb.ID + "]") handaleSSB()
def SaveASCmd(): global file, ssb fName = filedialog.asksaveasfilename(defaultextension=".bind", filetypes=(("Amiibo Decripted", "*.bind"), ("Amiibo Decripted", "*.bind"))) if fName: curentfile = file.name file.close() with open(curentfile, 'rb') as fp: data = fp.read() with open(fName, 'wb') as fp: fp.write(data) file = open(fName, "rb+") ssb = ssbu(file) SaveCmd() handaleFile()