Skip to content

Conversation

@Debilski
Copy link
Member

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:

Screenshot From 2025-08-15 17-22-04

With the fix:

Screenshot From 2025-08-15 17-21-45

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.

@Debilski
Copy link
Member Author

Useful addition might be to add a few preset scaling factors (on the number keys?) that can be quickly selected.

@Debilski
Copy link
Member Author

Very weird things going on here. Directly after a reboot, the measuring does not work. It only measures correctly the second time that I run pelita. Do you happen to have any idea @otizonaizit ?

Screencast.From.2025-08-18.16-31-18.mp4

@Debilski
Copy link
Member Author

gitk is having the same problem (works fine on second open). If gitk is opened before Pelita, then all is good.

@Debilski
Copy link
Member Author

Debilski commented Aug 18, 2025

Traced it down to being related to Wayland/Xwayland I think. If I run something like xclock before Pelita, all is good …

@Debilski Debilski force-pushed the feature/scalable-canvas branch from f2a7573 to b686b84 Compare September 15, 2025 08:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant