def show_properties(self, object_): for i in self.properties_widgets.values(): for widget in i: if isinstance(widget, list): widget[0].grid_forget() else: widget.grid_forget() self.current_obj = object_ nb = 0 for k, v in object_.properties(): label = Label(self, text=self.main.lang.get_translate("properties_"+k, k.replace("_", " ").title()+": "), font=("Arial", "14")) label.grid(row=2+nb, column=0, sticky="EW", padx=10, pady=10) if k == "type_": other = Label(self, text=v, font=("Arial", "14")) other.grid(row=2+nb, column=1, sticky="EW", padx=50, pady=10) elif k == "material": other = Combobox(self, values=BLOCK_MATERIALS) other.current(BLOCK_MATERIALS.index(v)) other.grid(row=2+nb, column=1, sticky="EW", padx=50, pady=10) elif k == "itemgroup": list_ = [i.name.upper().replace(" ", "_")+"_GROUP" for i in self.main.project.objects["itemgroups"]] + \ ITEMGROUP other = Combobox(self, values=list_) other.current(list_.index(v)) other.grid(row=2+nb, column=1, sticky="EW", padx=50, pady=10) elif k == "icon": list_ = [i.name.upper().replace(" ", "_") for i in self.main.project.objects["blocks"]] + ICON_BLOCKS other = Combobox(self, values=list_) other.current(list_.index(v)) other.grid(row=2+nb, column=1, sticky="EW", padx=50, pady=10) elif k in ("search", "loot"): var = IntVar() other = [Checkbutton(self, variable=var), var] if v: other[0].invoke() other[0].grid(row=2+nb, column=1, sticky="EW", padx=50, pady=10) elif k == "script": other = Text(self) other.insert("1.0", v) other.grid(row=2+nb, column=1, sticky="EW", padx=50, pady=10) else: other = Entry(self) other.insert(0, v) other.grid(row=2+nb, column=1, sticky="EW", padx=50, pady=10) nb += 1 self.properties_widgets[k] = [label, other] s = Style() s.configure('test.TButton', font=('Arial', 14)) btn = Button(self, text=self.main.lang.get_translate("properties_validate", "Validate"), command=self.set_properties, style="test.TButton") btn.grid(row=2+nb, column=0, sticky="EW", padx=50, pady=20, columnspan=2) self.properties_widgets['BTN_VALIDATE'] = [btn]