WIP: Experiments with scalable canvas #910
Draft
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.
Workable solution for #820. Still needs adjustments. Unclear, if the tk internal scaling for widgets(?)
self.root.tk.call('tk', 'scaling', xxx)will be needed.How does it work: We can use Tk to measure the pixel width of a text with a given font size. The result will be in raw pixels (on Linux). On macOS the number is resolution independent (which is good: on macOS it already works as it should). I could not test with Windows yet.
This number will then scale the geometry of the Window and then our own scaling mechanics will resize the canvas to make everything fit.
Screen is set to scale to 225%. Without the fix:
With the fix:
Note that the font and hard-coded numbers for the positioning of the header are currently not scaled, which is why they do look off. Work also needs to be done for the debug mode whose 1px grid lines look very tiny on higher scaling factors.