Akascape / CTkToolTip

Small pop-up widget for displaying details inside customtkinter. (extension/add-on)
Creative Commons Zero v1.0 Universal
104 stars 6 forks source link

ToolTip elevates main window when used in CTkToplevel window #18

Open Dominik-esb opened 7 months ago

Dominik-esb commented 7 months ago

Senario: main window -> button click -> create CTkToplevel window -> CTkRadioButton -> CTkToolTip for CTkRadioButton

When hovering over the RadioButton in the popup window, the main window gets elevated. The ToolTip is displayed properly. When closing the pop up window invalid command name error:

^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/customtkinter/windows/widgets/core_rendering/draw_engine.py", line 137, in __draw_rounded_rect_with_border_polygon_shapes if not self._canvas.find_withtag("border_parts"): ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/tkinter/__init__.py", line 2923, in find_withtag return self.find('withtag', tagOrId) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/tkinter/__init__.py", line 2890, in find self.tk.call((self._w, 'find') + args)) or () ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ _tkinter.TclError: invalid command name ".!tabview.!ctktoplevel.!backupcreateview.!ctkframe.!canvas.!ctkscrollableframe.!ctkradiobutton52.!ctkcanvas2"

Screenshot 2023-12-17 at 19 29 42 Screenshot 2023-12-17 at 19 29 53
samuelzamvil commented 3 months ago

I was seeing similar behavior on macOS. Removing self.master from the following line or commenting it out completely resolved the issue for me. I'm not sure if this change will cause inadvertent side effects.

https://github.com/Akascape/CTkToolTip/blob/e9448cb7fc24d83f0d8e2754bb9a9b76ebb4594b/CTkToolTip/ctk_tooltip.py#L50