def preference_button(window, pre_dictionary, choice_dic, name): return_dictionary = {} for preference in list(choice_dic.keys()): return_dictionary[preference] = [] i = 0 for choice in choice_dic[preference]: if choice.get() == 1: return_dictionary[preference].append(pre_dictionary[preference][i]) i += 1 gL.add_preferences_to_user(name.get(), return_dictionary) start_menu.start_menu_window(window, name)
def preference_button(window, frame, pre_dictionary, choice_dic, name, rowindex, fileBackground2): return_dictionary = {} for preference in list(choice_dic.keys()): return_dictionary[preference] = [] i = 0 for choice in choice_dic[preference]: if choice.get() == 1: return_dictionary[preference].append( pre_dictionary[preference][i]) i += 1 # check if the list is empty if len(return_dictionary['Genre']) == 0: Need = Label(frame, text='must choose Genre', fg='red', bg="white", font=("Comic Sans MS", 12)) Need.grid(row=rowindex + 2, columnspan=7, pady=(5, 5)) else: # everything ok gL.add_preferences_to_user(name.get(), return_dictionary) # go to stare menu start_menu.start_menu_window(window, name, fileBackground2)