Repository: spyder-ide/spyder

Issue:
TypeError when showing DPI message in Python 3.10
## Description

### What steps will reproduce the problem?

<!--- You can use Markdown here --->

This error showed up after I woke my laptop from sleep with external monitors connected.  Not sure if there's a connection or not.

### Traceback
```python-traceback
Traceback (most recent call last):
  File "C:\Users\jerem\anaconda3\envs\scraper\lib\site-packages\spyder\plugins\application\container.py", line 516, in handle_new_screen
    self.show_dpi_change_message(new_screen_dpi)
  File "C:\Users\jerem\anaconda3\envs\scraper\lib\site-packages\spyder\plugins\application\container.py", line 588, in show_dpi_change_message
    self.dpi_messagebox.move(x, y)
TypeError: arguments did not match any overloaded call:
  move(self, QPoint): argument 1 has unexpected type 'float'
  move(self, int, int): argument 1 has unexpected type 'float'
```

## Versions

* Spyder version: 5.3.0 
* Python version: 3.10.4
* Qt version: 5.12.9
* PyQt5 version: 5.12.3
* Operating System: Windows 10

### Dependencies

```
# Mandatory:
atomicwrites >=1.2.0          :  1.4.0 (OK)
chardet >=2.0.0               :  4.0.0 (OK)
cloudpickle >=0.5.0           :  2.0.0 (OK)
cookiecutter >=1.6.0          :  1.7.3 (OK)
diff_match_patch >=20181111   :  20200713 (OK)
intervaltree >=3.0.2          :  3.0.2 (OK)
IPython >=7.31.1;<8.0.0       :  7.32.0 (OK)
jedi >=0.17.2;<0.19.0         :  0.18.1 (OK)
jellyfish >=0.7               :  0.9.0 (OK)
jsonschema >=3.2.0            :  4.4.0 (OK)
keyring >=17.0.0              :  23.4.0 (OK)
nbconvert >=4.0               :  6.4.5 (OK)
numpydoc >=0.6.0              :  1.2.1 (OK)
paramiko >=2.4.0              :  2.10.3 (OK)
parso >=0.7.0;<0.9.0          :  0.8.3 (OK)
pexpect >=4.4.0               :  4.8.0 (OK)
pickleshare >=0.4             :  0.7.5 (OK)
psutil >=5.3                  :  5.9.0 (OK)
pygments >=2.0                :  2.11.2 (OK)
pylint >=2.5.0                :  2.13.5 (OK)
pyls_spyder >=0.4.0           :  0.4.0 (OK)
pylsp >=1.4.1;<1.5.0          :  1.4.1 (OK)
pylsp_black >=1.2.0           :  1.2.0 (OK)
qdarkstyle >=3.0.2;<3.1.0     :  3.0.3 (OK)
qstylizer >=0.1.10            :  0.2.1 (OK)
qtawesome >=1.0.2             :  1.1.1 (OK)
qtconsole >=5.3.0;<5.4.0      :  5.3.0 (OK)
qtpy >=2.0.1                  :  2.0.1 (OK)
rtree >=0.9.7                 :  1.0.0 (OK)
setuptools >=49.6.0           :  62.0.0 (OK)
sphinx >=0.6.6                :  4.5.0 (OK)
spyder_kernels >=2.3.0;<2.4.0 :  2.3.0 (OK)
textdistance >=4.2.0          :  4.2.2 (OK)
three_merge >=0.1.1           :  0.1.1 (OK)
watchdog >=0.10.3             :  2.1.7 (OK)
zmq >=17                      :  22.3.0 (OK)

# Optional:
cython >=0.21                 :  None (NOK)
matplotlib >=3.0.0            :  None (NOK)
numpy >=1.7                   :  1.22.3 (OK)
pandas >=1.1.1                :  1.4.2 (OK)
scipy >=0.17.0                :  None (NOK)
sympy >=0.7.3                 :  None (NOK)
```



Discussion:
Hey @jeremymatt, thanks for reporting. This seems a small error that only happens in Python 3.10 because it doesn't automatically convert floats to integers.

We'll fix it in our next version (5.3.1), to be released soon.

Resolving patch:
diff --git a/spyder/plugins/application/container.py b/spyder/plugins/application/container.py
--- a/spyder/plugins/application/container.py
+++ b/spyder/plugins/application/container.py
@@ -577,6 +577,7 @@ def show_dpi_change_message(self, dpi):
             self.dpi_messagebox.finished.connect(
                 lambda result: self.handle_dpi_change_response(result, dpi))
             self.dpi_messagebox.open()
+
             # Show dialog always in the primary screen to prevent not being
             # able to see it if a screen gets disconnected while
             # in suspended state. See spyder-ide/spyder#16390
@@ -585,4 +586,7 @@ def show_dpi_change_message(self, dpi):
             screen_geometry = QGuiApplication.primaryScreen().geometry()
             x = (screen_geometry.width() - dpi_messagebox_width) / 2
             y = (screen_geometry.height() - dpi_messagebox_height) / 2
-            self.dpi_messagebox.move(x, y)
+
+            # Convert coordinates to int to avoid a TypeError in Python 3.10
+            # Fixes spyder-ide/spyder#17677
+            self.dpi_messagebox.move(int(x), int(y))


Test patch: