-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
axis and glyph scaling issue with Multiple DPI monitors #756
Comments
I'm having the same problem. Description can be found here. I am trying to fix this in pyqtgraph, but I cannot find the place where the grid is getting drawn. Can anybody help with that? |
@dvincentwest thanks so much for the screen shots, they really illustrate what's happening, only machine I have with a 4k monitor is a laptop I only periodically use and don't have a development environment setup; but I'll try and reproduce the issue there. @cosminpolifronie if you're still trying to solve this issue, could you see if you can recreate it when installing from the develop branch? |
@j9ac9k Yup, I can still recreate it using pyqtgraph-0.11.0.dev0+g78df356 |
Thanks for reporting back, I'll look into it in the next day or so hopefully |
@cosminpolifronie Thanks again for putting the effort to re-verify. It might be a bit before you get to it, if you're waiting for this, and have a few minutes, could you try inserting the following lines QtGui.QApplication.setAttribute(Qt.AA_EnableHighDpiScaling)
if hasattr(QtWidgets.QStyleFactory, "AA_UseHighDpiPixmaps"):
QtGui.QApplication.setAttribute(Qt.AA_UseHighDpiPixmaps) right before this line here: Line 336 in 78df356
If you're not comfortable editing the source of the library that's fine, I'll get to it. |
I have added the lines you suggested, but the bug is not fixed (I've tried to add them before the Look at the following video: https://youtu.be/X4ltNIjDuz4 The first screen that I'm opening the app in is the main screen with 125% scaling (2560x1440), and the second one has 100% scaling (1920x1080). You can see that when I'm dragging the plot on the second screen, the background grid moves at a different speed. That shouldn't happen. |
Thanks for the videos highlighting this issue I completely understand the problem; I've assigned myself some issues and I have some PRs to review first, but I'll poke around with this... Do you have any suggestions on how we can make a test that will actually fail for this issue? |
Can this be automatically tested, as it is a display error? Do we have any means to probe into the actual displayed elements (as in pixels, maybe)? |
If I was to characterize this, I would say that during a drag event, the mouse does not remain at the same coordinates within the view. First step is definitely to make a test that simulates a mouse drag event (there are other tests in the test suite that do this) and we can show that the mouse position within the view did not remain the same. What I don't know how to do in the test suite is to capture the monitor scaling that's occurring. |
I don't have any kind of experience with testing, so I'll have to learn to be helpful. Tomorrow I'll have my last exam before I finish university, and after that I could look into it. It could take a while, but I'm willing to learn.
I don't understand. Are we talking about the same issue? |
In your video, when you click on drag, the mouse stays in the same position, relative to the grid on the right monitor, but on the left monitor the mouse position moves in relation to the grid. Is that not the issue you're describing? |
Oooh, I didn't look at it this way. Yes, it is one problem, but there are others: the plot is badly represented in height (it's shifted downwards), and the plot and the grid move out of sync (they move at different speeds, the grid stays sychronized to the mouse movement while the plot does not and "floats"). Basically, when you move the plot, the |
I'm experiencing a similar bug. Any new news on how to fix it? However its more along the lines of #795 |
An item in the changelog for Qt 5.13.1 caught my attention that may be relevant:
I would be eager to get an update on this issue if either of you install either PySide2 5.13.1 or PyQt 5.13.1 and report back. Thanks |
Sadly the bug is still there with PyQt 5.13.1 😢. |
I'm seeing something similar (I think), viewing a plot on a 4k display with 250% scaling, the line in the plot seems to become discontinuous? I'll try to upload a screenshot soon. |
I was able to fix this issue by adding:
after the imports in your example. Here's a relevant mailing list post: https://lists.qt-project.org/pipermail/development/2019-September/037434.html Working example:
|
@andybarry Thank you so much for sharing! If I'm reading it right, this was introduced in Qt 5.14, so this will only work on newer versions of Qt, but I see no reason not to add this to |
@andybarry solution makes my app blurry and fonts too small... has anyone managed to find a solution for this? |
@luiztauffer I've self-assigned hidpi issues as I have a windows laptop w/ a hidpi monitor and an external non-hidpi display I can test on. I'm not sure when I'm going to get to it, or if I'm going to be able to find a solution. My first priority is working on the PR backlog (we're down to 30-something from 180 a year ago!). That said, this matplotlib issue may be of relevance, they identified a fix, but I think it requires Qt 5.15+ If you implement their fix, please do report back! |
Another option: https://stackoverflow.com/a/48431398/730138 |
I had the same problem (Windows 10 , display scale to 125%, Python3.7, pyqtgraph 0.11, PySide2 5.15.1). This solution works for me. you can make your app DPI-aware by using the following code before you load any GUI elements:
And running this somewhere in your code:
I run this function before QApplication. |
I'm working on #1509 and I tried implementing this, but this seemed to make text in the example app blurry (on Qt 5.12)... lots of combinations to try out over here still... |
for PySide2 with Qt-Version 5.15 I was able to fix this by adding the following two lines before app = QApplication(sys.argv)
I hope I can help some ppl out with that. |
Thanks for sharing @RitterD, this also fixes our long standing issue here. Cheers! |
I downloaded the latest pyqtgraph version 0.12.3 from git (pip install git+https://github.com/pyqtgraph/pyqtgraph.git) and expected this issue to be solved. What package do I have to install to get it fixed (beginner skill on myside ;-) )? |
By combining this code and this I get good-looking plots with a multi-dpi setting with different scalings. But the solution is very lengthy to include in the beginning of every script. I would very much appreciate a proper fix.
|
@karahanyilmazer I can confirm, that this workaround works for me and I get proper scaling with non-100% dpi-scaling. |
I am happy to check this out, but I don't really know where to start.
I am running Windows10, Anaconda x64, python 3.6.6, and the below images were created using the latest git version of pyqtgraph, and PyQt5.9
I have two monitors, one at 1080p (set to 100% scaling) and the other at 4K (set to 150% scaling), and when switching between the two monitors windows will attempt to adjust their scaling accordingly. Some applications do this better than others, and this may in fact be an issue in Qt, but in case we can address it in the pyqtgraph code, that would probably be good.
The first image is on the 1080p monitor and the second is just from moving the window over to the 4K monitor. The problem is most easily seen in the gray plots in the upper left and lower right. You can see that the scatter clouds are centered at 0,0 in the 1080p plots, but are shifted to lower x and higher y coordinates in the 4k 150% plots. This is the major issue because it means the plots aren't accurate in presenting the coordinates of the data.
Weirdly, it also seems that some of the glyphs are shrinking while others are growing when the dpi change happens
Lastly, I can confirm that if I switch the 1st monitor to 150% scaling before starting python, this issue does not happen. It is only an issue when switching from a monitor at one dpi setting to a different one
1080p, 100% Scaling
4K, 150% Scaling
The text was updated successfully, but these errors were encountered: