Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork8.1k
Matplotlib Device Scaling on Windows#30599
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
base:main
Are you sure you want to change the base?
Conversation
self.window.protocol("WM_DELETE_WINDOW",destroy) | ||
self.window.deiconify() | ||
self.canvas._tkcanvas.focus_set() | ||
ifself._window_dpi.get()!=96: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
why hard-code 96?
How does this intersect with the discussion in#21875 ? |
(GetDpiForWindow_t)GetProcAddress(user32,"GetDpiForWindow"); | ||
if (GetDpiForWindowPtr ==NULL) { | ||
FreeLibrary(user32); | ||
returnpy::cast(false); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
Is completely returning here correct? Is there a case where we may not be able to get the methods for managing the dpi but still need to run thesetWindowSubclass
method?
// window_dpi variable stored on interp. | ||
typedefUINT (WINAPI *GetDpiForWindow_t)(HWND); | ||
GetDpiForWindow_t GetDpiForWindowPtr = | ||
(GetDpiForWindow_t)GetProcAddress(user32,"GetDpiForWindow"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
Please use the shorter style for casting as in#30615.
PR summary
This PRcloses#26733.
Basically, the change in DPI is signaled when resizing or changing the device scale, and not when the canvas is launched/loaded, hence the issue.
Thisvideo demonstrates the problem and the fix.