def show_text(self, *args): try: id = self.box_list.curselection() luku = int(id[0]) except Exception: luku = self.last_list_selection category_luku = self.last_category_selection for armor in self.contr.settings.armors: if armor.get_attribute('brand')==self.box_categories.get(category_luku): #print('past the first if statement in armor sp retrieval') #print(armor.get_attribute('name')) #print(self.box_list.get(luku)) full_name = armor.get_attribute('brand') + " " + armor.get_attribute('name') if full_name==self.box_list.get(luku): #print('past the second if statement in armor sp retrieval') for loc in self.armorbox.segmented_file_array: bodypart_name = loc[1] #self.armorbox.variables[bodypart_name].set(armor.get_attribute(bodypart_name)) #print(self.armorbox.variables[bodypart_name].get()) if int(self.armorbox.variables[bodypart_name].get()) == 0: self.armorbox.added_variables[bodypart_name].set('+' + str(armor.get_sp_value(bodypart_name))) else: #print('else lauseessa') e = Effective_armor() layer1=self.armorbox.variables[bodypart_name].get() #print('layer1' + layer1) layer2=armor.get_sp_value(bodypart_name) bonus = e.calc_sp_layers(layer1, layer2) self.armorbox.added_variables[bodypart_name].set('+' + str(bonus))