Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

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

Open
melwyncarlo wants to merge2 commits intomatplotlib:main
base:main
Choose a base branch
Loading
frommelwyncarlo:issue_26733

Conversation

melwyncarlo
Copy link

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.

self.window.protocol("WM_DELETE_WINDOW",destroy)
self.window.deiconify()
self.canvas._tkcanvas.focus_set()
ifself._window_dpi.get()!=96:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

why hard-code 96?

@tacaswell
Copy link
Member

How does this intersect with the discussion in#21875 ?

(GetDpiForWindow_t)GetProcAddress(user32,"GetDpiForWindow");
if (GetDpiForWindowPtr ==NULL) {
FreeLibrary(user32);
returnpy::cast(false);
Copy link
Member

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");
Copy link
Contributor

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.

Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@tacaswelltacaswelltacaswell left review comments

@anntzeranntzeranntzer left review comments

@richardsheridanrichardsheridanAwaiting requested review from richardsheridan

At least 1 approving review is required to merge this pull request.

Assignees
No one assigned
Labels
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

Figure sticks out of window after setting window to full screen from code
3 participants
@melwyncarlo@tacaswell@anntzer

[8]ページ先頭

©2009-2025 Movatter.jp