Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Scaling issues with PyQt5 when using mixed resolution displays #8061

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 our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
astrofrog opened this issue Feb 10, 2017 · 10 comments · Fixed by #8931
Closed

Scaling issues with PyQt5 when using mixed resolution displays #8061

astrofrog opened this issue Feb 10, 2017 · 10 comments · Fixed by #8931
Labels
Milestone

Comments

@astrofrog
Copy link
Contributor

I have a set-up where I have a retina MBP (bottom) plugged in to a non-retina display (top).

Normally Matplotlib looks fine on retina or non-retina displays when used separately, but in the case of mixed resolutions, the fonts and the elements of the figure appear too large on the non-retina display. The following image sequence shows a matplotlib window that was created on the retina display and is then moved to the non-retina display. The same issue happens if I create the figure in the non-retina display to start with, so this is not about moving from one to the other.

screen shot 2017-02-10 at 17 45 41
screen shot 2017-02-10 at 17 45 51
screen shot 2017-02-10 at 17 45 59
screen shot 2017-02-10 at 17 46 04

I then click in the bottom right to resize the window:

screen shot 2017-02-10 at 17 46 17

@tacaswell
Copy link
Member

Does Qt provide a signal we can hook into when the window changes screens (and hence the dpi scaling)?

@tacaswell tacaswell added this to the 2.1 (next point release) milestone Feb 10, 2017
@astrofrog
Copy link
Contributor Author

Looks like the easiest way is to look for screenChanged then in there check if devicePixelRatio changes:

https://forum.qt.io/topic/52296/detect-changing-devicepixelratio/4

@astrofrog
Copy link
Contributor Author

astrofrog commented May 5, 2017

Note that this also causes issues when just showing a plot on the lower-res screen that is attached to a retina screen laptop (the fonts are two times too large and lines two times too thick) - that is, without even changing screen. I think this is something to do with the fact that the DPI device ratio is declared to be 1 for the low-res screen. If I force _dpi_ratio to return 2 then the scaling looks correct on the low-res screen (but the mouse events are then wrong...). Can people test what the behavior is like on other OSes with mixed-resolution screens?

@astrofrog
Copy link
Contributor Author

@QuLogic - do you have any ideas since you've worked on the DPI ratio stuff before?

@tacaswell
Copy link
Member

@astrofrog can you check with v2.0.1?

@tacaswell tacaswell modified the milestones: 2.0.3 (next bug fix release), 2.1 (next point release) May 7, 2017
@astrofrog
Copy link
Contributor Author

astrofrog commented May 8, 2017

@tacaswell - this is still an issue with 2.0.1 unfortunately

@efiring
Copy link
Member

efiring commented May 8, 2017

It looks like you identified at least part of the machinery we need to add (screenChanged, etc.); any chance you can have a go at implementing it?

@tacaswell tacaswell modified the milestones: 2.0.3 (next bug fix release), 2.1 (next point release) May 12, 2017
@astrofrog
Copy link
Contributor Author

All right, I'm going to take a look at this today. This has been bugging me for a while. Wish me luck.

@burnpanck
Copy link

burnpanck commented Aug 18, 2017

This bug report here describes two problems:

  1. The figure did not properly get notified on a DPI change
  2. The figure is rendered with incorrect DPI settings on the low-DPI monitor if a hi-DPI monitor is available on the system as-well.

#8931 only fixes the first of the two issues. Should this bug report be reopened or a separate one be created?

@tacaswell
Copy link
Member

@burnpanck Can you make a new issue for the second?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants