Python - Get the list of menubutton created dynamically -
i have created menubutton list['abc', 'xyx', pqr] dynamically in state=disabled default.
for name, val in sorted(default_dict_of_config.items(), reverse=true): self.menubutton_for_config = tk.menubutton(self, text=name, indicatoron=true, borderwidth=1, width=20, relief="raised", state=disabled, textvariable=name) self.menu_for_config = tk.menu(self.menubutton_for_config, tearoff=false) self.menubutton_for_config.configure(menu=self.menu_for_config) self.menubutton_for_config.pack(side=bottom, fill=x) # empty list , dictionary next iteration self.list_choices_for_config = [] self.choices_for_config = {} choice in sorted(val): self.choices_for_config[choice] = tk.intvar(value=0) self.menu_for_config.add_checkbutton(label=choice, variable=self.choices_for_config[choice], onvalue=1, offvalue=0, command=self.set_filter)` now want enabled menubutton 1 one based condition. like
if self.menubutton_for_config.cget("text") == name: self.menubutton_for_config.config(text="pqr") self.menubutton_for_config.config(state=tk.normal) any appreciated !!
Comments
Post a Comment