fix(launcher): recreate tooltip window on resize so it tracks the new scaling (#2111) - #2352
Closed
Anai-Guo wants to merge 1 commit into
Closed
fix(launcher): recreate tooltip window on resize so it tracks the new scaling (#2111)#2352Anai-Guo wants to merge 1 commit into
Anai-Guo wants to merge 1 commit into
Conversation
… scaling (LostRuins#2111) After a window resize, ctk.set_widget_scaling() updates the global widget scale for every CustomTkinter widget. The cached CTkToplevel tooltip and its CTkLabel were created before the resize and their internal geometry is stale — on the next hover update_idletasks() measures the outdated size and wm_geometry preserves it, leaving a near-zero-width window that cannot display any text. Fix: add nonlocal gtooltip_box/gtooltip_label to actually_resize and destroy/reset the pair right after set_widget_scaling(). The next mouse-enter recreates the tooltip window cleanly under the new scale. Signed-off-by: Tai An <antai12232931@anaiguo.com>
Author
|
Note for reviewer: the actual fix is just 4 lines in the def actually_resize(windowwidth,windowheight,lastpos,smallratio):
+ nonlocal gtooltip_box, gtooltip_label
root.geometry(str(windowwidth) + "x" + str(windowheight) + str(lastpos))
ctk.set_widget_scaling(smallratio)
+ if gtooltip_box:
+ gtooltip_box.destroy()
+ gtooltip_box = None
+ gtooltip_label = NoneThis destroys and resets the cached tooltip window after scale change so it is recreated fresh on the next hover. |
Can't you rebase the PR branch on top of current |
Owner
|
rebase would be good but since this patch is tiny, i went ahead and added it directly. 01f2fa5 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes #2111. After the user resizes the KoboldCpp launcher window, the floating tooltip windows shrink to a sliver too narrow to display any text.
Root cause:
actually_resizecallsctk.set_widget_scaling(smallratio), which updates the global scaling for every CustomTkinter widget. The singleton tooltip (CTkToplevel+CTkLabel) was created before the resize and its internal geometry is now stale — on the next hover,update_idletasks()measures the outdated size andwm_geometrypreserves it, leaving a near-zero-width window.Fix: Declare
gtooltip_box/gtooltip_labelasnonlocalinsideactually_resizeand destroy/reset the pair immediately afterset_widget_scaling. The next mouse-enter recreates the window cleanly under the new scale.Test plan
Assisted-by: Claude
🤖 Generated with Claude Code