Added (un)block_update_dimensions_event handling function.#37
Open
kabyru wants to merge 1 commit intoAkascape:mainfrom
Open
Added (un)block_update_dimensions_event handling function.#37kabyru wants to merge 1 commit intoAkascape:mainfrom
kabyru wants to merge 1 commit intoAkascape:mainfrom
Conversation
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.
Hello, I would like to contribute a code update to handle Tkinter resolution scaling events that are sent to this widget. When a GUI widget is ran in a desktop environment that has a scaled resolution (say you're using a laptop with a 4K display but it is scaled 150% via Windows resolution settings), Tkinter will handle scale-up events for widgets by sending a block_update_dimensions_event. This event is handled at the CTk level, but needs to be addressed at this widget level to prevent the widget from breaking due to this event being unhandled.
When unhandled, the CTkToolTip widget can enter into a state that where the alpha-transparency of the widget is broken, leaving tooltips very transparent regardless of the alpha setting set for the widget. By handling these events, we can ensure that this adverse behavior does not happen. So, I am proposing we add code to CTkToolTip that handles these events by simply returning
True, which will preserve existing tooltip behavior and ensure the alpha-transparency of widgets does not break on scaled-up resolution displays.Attached are pictures showing examples of broken behavior caused by not handling this event:
Example traceback from event being unhandled:

Example impact to CTkToolTip widget when event is unhandled:

Example of widget functioning with new code, when the window rides between a scaled display and an unscaled display (this situation will always trigger the event in question):
