Fix: Resolve TclError by managing animated icon clickability via bindings
- Replaced direct 'state' configuration on ttk.Frame (animated_icon_frame) with dynamic binding/unbinding of the '<Button-1>' event. - This resolves the '_tkinter.TclError: unknown option "-state"' as ttk.Frame does not support the 'state' option. - Ensures the animated icon is only clickable when an update is available, improving UI behavior and error handling.
This commit is contained in:
12
menu_bar.py
12
menu_bar.py
@@ -244,8 +244,16 @@ class MenuBar(ttk.Frame):
|
||||
|
||||
# The update_btn (toggle updates on/off) should always be active
|
||||
self.update_btn.config(state="normal")
|
||||
self.animated_icon_frame.config(state=animated_icon_frame_state,
|
||||
cursor="arrow" if animated_icon_frame_state == "disabled" else "hand2")
|
||||
|
||||
if animated_icon_frame_state == "disabled":
|
||||
self.animated_icon_frame.unbind("<Button-1>")
|
||||
self.animated_icon.unbind("<Button-1>")
|
||||
self.animated_icon_frame.config(cursor="arrow")
|
||||
else:
|
||||
self.animated_icon_frame.bind("<Button-1>", lambda e: self.updater())
|
||||
self.animated_icon.bind("<Button-1>", lambda e: self.updater())
|
||||
self.animated_icon_frame.config(cursor="hand2")
|
||||
|
||||
Tooltip(self.update_btn, tooltip_msg, state_var=self.tooltip_state)
|
||||
Tooltip(self.animated_icon_frame, tooltip_msg,
|
||||
state_var=self.tooltip_state)
|
||||
|
Reference in New Issue
Block a user