spyder
spyder copied to clipboard
Display issues with multiple screens
Issue Report Checklist
- [x] Searched the issues page for similar reports
- [x] Read the relevant sections of the Spyder Troubleshooting Guide and followed its advice
- [x] Reproduced the issue after updating with
conda update spyder
(orpip
, if not using Anaconda) - [x] Could not reproduce inside
jupyter qtconsole
(if console-related) - [x] Tried basic troubleshooting (if a bug/error)
- [x] Restarted Spyder
- [x] Reset preferences with
spyder --reset
- [x] Reinstalled the latest version of Anaconda
- [x] Tried the other applicable steps from the Troubleshooting Guide
- [x] Completed the Problem Description, Steps to Reproduce and Version sections below
Problem Description
I have two screens:
- Screen 1, of native resolution 3840x2160
- Screen 2, of native resolution 1920x1080
When I start Spyder with screen 1 turned off (laptop lid closed), Spyder display is bad: some fonts are massive (which prevents to resize internal windows in some case), the pyplot windows open off screen.
Tweaking the DPI options in the settings did not fix the issue. Opening Spyder when both screens are on fixes the issue.
Screenshot (after spyder reset):
What steps reproduce the problem?
- With screen 1 off, open Spyder
What is the expected output? What do you see instead?
Expected a decent rendering. Obtain a poor rendering.
Paste Traceback/Error Below (if applicable)
No error in the internal console. Here are some debug information:
>>> spy.window.screen.size()
PyQt5.QtCore.QSize(1920, 1080)
>>> spy.window.screen.virtualSize()
PyQt5.QtCore.QSize(1920, 1080)
>>> spy.window.screen.geometry()
PyQt5.QtCore.QRect(0, 0, 1920, 1080)
>>> spy.window.screen.name()
'\\\\.\\DISPLAY2'
>>> spy.window.screen.logicalDotsPerInch()
96.0
>>> spy.window.screen.physicalDotsPerInch()
93.61458995237565
Versions
- Spyder version: 4.1.3 (obtained from anaconda channel in conda)
- Python version: 3.7.6 64-bit
- Qt version: Qt 5.9.6
- PyQt version: PyQt5 5.9.2
- Operating System name/version: Windows 10
Dependencies
# Mandatory:
atomicwrites >=1.2.0 : 1.4.0 (OK)
chardet >=2.0.0 : 3.0.4 (OK)
cloudpickle >=0.5.0 : 1.4.1 (OK)
diff_match_patch >=20181111 : 20181111 (OK)
intervaltree : None (OK)
IPython >=4.0 : 7.13.0 (OK)
jedi =0.15.2 : 0.15.2 (OK)
nbconvert >=4.0 : 5.6.1 (OK)
numpydoc >=0.6.0 : 0.9.2 (OK)
paramiko >=2.4.0 : 2.7.1 (OK)
parso =0.5.2 : 0.5.2 (OK)
pexpect >=4.4.0 : 4.8.0 (OK)
pickleshare >=0.4 : 0.7.5 (OK)
psutil >=5.3 : 5.7.0 (OK)
pygments >=2.0 : 2.6.1 (OK)
pylint >=0.25 : 2.5.2 (OK)
pyls >=0.31.9;<0.32.0 : 0.31.10 (OK)
qdarkstyle >=2.8 : 2.8.1 (OK)
qtawesome >=0.5.7 : 0.7.0 (OK)
qtconsole >=4.6.0 : 4.7.4 (OK)
qtpy >=1.5.0 : 1.9.0 (OK)
rtree >=0.8.3 : 0.9.4 (OK)
sphinx >=0.6.6 : 3.0.4 (OK)
spyder_kernels >=1.9.1;<1.10.0 : 1.9.1 (OK)
watchdog : None (OK)
zmq >=17 : 18.1.1 (OK)
# Optional:
cython >=0.21 : 0.29.17 (OK)
matplotlib >=2.0.0 : 3.1.3 (OK)
numpy >=1.7 : 1.18.1 (OK)
pandas >=0.13.1 : 1.0.3 (OK)
scipy >=0.17.0 : 1.4.1 (OK)
sympy >=0.7.3 : 1.5.1 (OK)
Hi @nbud, when you changed the DPI options did you used the option Enable auto high DPI scaling
? Could you try restarting Spyder with the Enable auto high DPI scaling
on?
We will be checking this in a future release. Thanks for the feedback!
Hi @dalthviz, I have tried the "normal", "auto" and "fixed" DPI scaling settings (with a restart between each), with no success.
Thanks for the info @nbud ! We will be checking this one in a future release :+1:
I found a fix: right-click on Spyder shortcut, Properties, then Compatibility tab, Change high DPI settings.
Tick Override high DPI scaling behaviour, select Scaling performed by System.
Thanks nbud: it solves the issue. For the coding part, QT from 5.4 is supporting High DPI: https://doc.qt.io/qt-5/highdpi.html From their documentation, they state for the migration:
To get an application designed for low DPI values running on high resolution monitors quickly, consider one of the following: let the application run as DPI Unaware on Windows set the QT_AUTO_SCREEN_SCALE_FACTOR environment variable to 1.
Thanks for the info @nbud @datiti on how to work around the issue!
Same problems here on Linux. Spyder messes with my custom set environment variables and destroys Qt's per screen scaling. It works as expected if commenting out this code: https://github.com/spyder-ide/spyder/blob/bbefcebd48a93cd08f2f17be86d3ce7478e5130f/spyder/app/start.py#L98-L107
It should probably check if the enviroment variables are set before overwriting them. I could create a PR for that.
Hi @hpfmn thanks for the feedback! we set the env vars using the values in the preferences
but maybe, as you suggest, we need to handle the case where these values are being set outside Spyder, @ccordoba12 what do you think?
It should probably check if the enviroment variables are set before overwriting them. I could create a PR for that.
If you're referring to add a check in the else
part of the code you referenced above, then I agree with add a check to see if those variables are set before overwriting them.
Well, it's 3.5 years later, and I have the same problem. I tried the fix by @nbud, but it didn't change anything. I've posted my details on other open issues of the same problem, so I'll just leave it that this work-around is not working in my case...nor are any settings in the app Spyder 5.5.1 on Windows 11