spyder icon indicating copy to clipboard operation
spyder copied to clipboard

Display issues with multiple screens

Open nbud opened this issue 4 years ago • 10 comments

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 (or pip, 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):

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

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

nbud avatar Jun 10 '20 06:06 nbud

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!

dalthviz avatar Jun 10 '20 15:06 dalthviz

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

nbud avatar Jun 11 '20 06:06 nbud

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

dalthviz avatar Jun 11 '20 14:06 dalthviz

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

nbud avatar Jun 23 '20 13:06 nbud

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.

datiti avatar Jun 25 '20 09:06 datiti

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

dalthviz avatar Jun 27 '20 00:06 dalthviz

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.

hpfmn avatar Jul 25 '20 11:07 hpfmn

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?

dalthviz avatar Jul 25 '20 16:07 dalthviz

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.

ccordoba12 avatar Jul 26 '20 15:07 ccordoba12

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

bramson avatar Feb 13 '24 09:02 bramson