spyder-ide / spyder

Official repository for Spyder - The Scientific Python Development Environment
https://www.spyder-ide.org
MIT License
8.22k stars 1.59k forks source link

Display issues with multiple screens #12990

Open nbud opened 4 years ago

nbud commented 4 years ago

Issue Report Checklist

Problem Description

I have two screens:

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):

spyder dpi issue

What steps reproduce the problem?

  1. 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

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)
dalthviz commented 4 years ago

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!

nbud commented 4 years ago

Hi @dalthviz, I have tried the "normal", "auto" and "fixed" DPI scaling settings (with a restart between each), with no success.

dalthviz commented 4 years ago

Thanks for the info @nbud ! We will be checking this one in a future release :+1:

nbud commented 4 years ago

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.

image image

datiti commented 4 years ago

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.

dalthviz commented 4 years ago

Thanks for the info @nbud @datiti on how to work around the issue!

hpfmn commented 4 years ago

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.

dalthviz commented 4 years ago

Hi @hpfmn thanks for the feedback! we set the env vars using the values in the preferences

image

but maybe, as you suggest, we need to handle the case where these values are being set outside Spyder, @ccordoba12 what do you think?

ccordoba12 commented 4 years ago

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.

bramson commented 7 months ago

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