I am trying to get a button to be disabled when the entrybox is empty and enabled when I type in something.
this is a part where the button and the entybox is.
self.description = tk.StringVar()
self.entry_ds = ttk.Entry(self, width=25,
textvariable=self.description)
self.entry_ds.grid(column=0, row=1, padx=13, pady=4)
self.entry_ds.focus()
self.co_button = ttk.Button(self, text='Confirm', command=self.on_press_ds)
self.co_button.grid(column=0, row=2, pady=4)
def on_press_ds(self):
description = self.description.get()
if description:
self.master.listbox.insert('end', description)
self.destroy_ds()
self.destroy()
I've tried using
if not self.description.get():
self.co_button['state'] = 'disabled'
and was able to get the entrybox disabled when it's empty, but I was unable to get enabled when I typed in something.