@@ -75,9 +75,9 @@ This is the **critical safety mechanism** that prevents timer leaks:
7575def _on_widget_destroy (self , event : Optional[tk.Event] = None ) -> None :
7676 """ Stop any active timers if the widget is destroyed."""
7777 self ._cancel_show() # Cancel "show" timer if pending
78- self ._cancel_hide() # Cancel "hide" timer if pending
78+ self ._cancel_hide() # Cancel "hide" timer if pending
7979 self ._cancel_timer(" alpha" ) # Cancel "alpha" timer if pending
80-
80+
8181 if self .tooltip:
8282 with contextlib.suppress(tk.TclError):
8383 self .tooltip.destroy()
@@ -86,7 +86,7 @@ def _on_widget_destroy(self, event: Optional[tk.Event] = None) -> None:
8686
8787** Why this is critical** :
8888- If the widget is destroyed while a timer is pending, Tk will try to fire a callback on a non-existent widget
89- - This causes ` tk.TclError: invalid command name "..." `
89+ - This causes ` tk.TclError: invalid command name "..." `
9090- The handler cleans up ALL timers before widget destruction
9191
9292** Binding registered in ` __init__ ` ** :
@@ -189,7 +189,7 @@ self._cancel_show() # Previous show timer canceled
189189- ** After** : Only Python object created (0.3-0.5KB memory, ~ 0.3ms per tooltip)
190190- ** Result** : 100-parameter table: ~ 200-300ms faster startup, ~ 1MB less memory
191191
192- ### Hover Phase
192+ ### Hover Phase
193193- ** Before** : Tooltip already exists, just show/hide (microseconds)
194194- ** After** : Tooltip created on-demand (2-3ms), then shown
195195- ** Result** : First hover noticeable (~ 3-5ms delay), subsequent hovers instant
0 commit comments