<h3 dir="auto">Bug summary</h3>
<p dir="auto"><code class="notranslate">import matplotlib.pyplot as plt</code></p>
<p dir="auto">Nomatter what drawing behavior(plot, scatter...) I uesd, I would always get below error:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="Traceback (most recent call last):
  File &quot;dt.py&quot;, line 14, in &lt;module&gt;
    plt.scatter(x, y, s=area, c=colors, alpha=0.5)
  File &quot;C:\Python37\Lib\site-packages\matplotlib\pyplot.py&quot;, line 2817, in scatter
    __ret = gca().scatter(
  File &quot;C:\Python37\Lib\site-packages\matplotlib\pyplot.py&quot;, line 2272, in gca
    return gcf().gca(**kwargs)
  File &quot;C:\Python37\Lib\site-packages\matplotlib\pyplot.py&quot;, line 865, in gcf
    return figure()
  File &quot;C:\Python37\Lib\site-packages\matplotlib\pyplot.py&quot;, line 809, in figure
    FigureClass=FigureClass, **kwargs)
  File &quot;C:\Python37\Lib\site-packages\matplotlib\pyplot.py&quot;, line 324, in new_figure_manager
    _warn_if_gui_out_of_main_thread()
  File &quot;C:\Python37\Lib\site-packages\matplotlib\pyplot.py&quot;, line 314, in _warn_if_gui_out_of_main_thread
    if (_get_required_interactive_framework(_get_backend_mod())
  File &quot;C:\Python37\Lib\site-packages\matplotlib\pyplot.py&quot;, line 217, in _get_backend_mod
    switch_backend(dict.__getitem__(rcParams, &quot;backend&quot;))
  File &quot;C:\Python37\Lib\site-packages\matplotlib\pyplot.py&quot;, line 262, in switch_backend
    switch_backend(candidate)
  File &quot;C:\Python37\Lib\site-packages\matplotlib\pyplot.py&quot;, line 282, in switch_backend
    class backend_mod(matplotlib.backend_bases._Backend):
  File &quot;C:\Python37\Lib\site-packages\matplotlib\pyplot.py&quot;, line 283, in backend_mod
    locals().update(vars(importlib.import_module(backend_name)))
  File &quot;C:\Python37\lib\importlib\__init__.py&quot;, line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File &quot;&lt;frozen importlib._bootstrap&gt;&quot;, line 1006, in _gcd_import
  File &quot;&lt;frozen importlib._bootstrap&gt;&quot;, line 983, in _find_and_load
  File &quot;&lt;frozen importlib._bootstrap&gt;&quot;, line 967, in _find_and_load_unlocked
  File &quot;&lt;frozen importlib._bootstrap&gt;&quot;, line 677, in _load_unlocked
  File &quot;&lt;frozen importlib._bootstrap_external&gt;&quot;, line 728, in exec_module
  File &quot;&lt;frozen importlib._bootstrap&gt;&quot;, line 219, in _call_with_frames_removed
  File &quot;C:\Python37\Lib\site-packages\matplotlib\backends\backend_qtagg.py&quot;, line 12, in &lt;module&gt;
    from .backend_qt import (
  File &quot;C:\Python37\Lib\site-packages\matplotlib\backends\backend_qt.py&quot;, line 76, in &lt;module&gt;
    for mod, key in [
  File &quot;C:\Python37\Lib\site-packages\matplotlib\backends\backend_qt.py&quot;, line 76, in &lt;listcomp&gt;
    for mod, key in [
TypeError: int() argument must be a string, a bytes-like object or a number, not 'KeyboardModifier'"><pre class="notranslate"><code class="notranslate">Traceback (most recent call last):
  File "dt.py", line 14, in &lt;module&gt;
    plt.scatter(x, y, s=area, c=colors, alpha=0.5)
  File "C:\Python37\Lib\site-packages\matplotlib\pyplot.py", line 2817, in scatter
    __ret = gca().scatter(
  File "C:\Python37\Lib\site-packages\matplotlib\pyplot.py", line 2272, in gca
    return gcf().gca(**kwargs)
  File "C:\Python37\Lib\site-packages\matplotlib\pyplot.py", line 865, in gcf
    return figure()
  File "C:\Python37\Lib\site-packages\matplotlib\pyplot.py", line 809, in figure
    FigureClass=FigureClass, **kwargs)
  File "C:\Python37\Lib\site-packages\matplotlib\pyplot.py", line 324, in new_figure_manager
    _warn_if_gui_out_of_main_thread()
  File "C:\Python37\Lib\site-packages\matplotlib\pyplot.py", line 314, in _warn_if_gui_out_of_main_thread
    if (_get_required_interactive_framework(_get_backend_mod())
  File "C:\Python37\Lib\site-packages\matplotlib\pyplot.py", line 217, in _get_backend_mod
    switch_backend(dict.__getitem__(rcParams, "backend"))
  File "C:\Python37\Lib\site-packages\matplotlib\pyplot.py", line 262, in switch_backend
    switch_backend(candidate)
  File "C:\Python37\Lib\site-packages\matplotlib\pyplot.py", line 282, in switch_backend
    class backend_mod(matplotlib.backend_bases._Backend):
  File "C:\Python37\Lib\site-packages\matplotlib\pyplot.py", line 283, in backend_mod
    locals().update(vars(importlib.import_module(backend_name)))
  File "C:\Python37\lib\importlib\__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "&lt;frozen importlib._bootstrap&gt;", line 1006, in _gcd_import
  File "&lt;frozen importlib._bootstrap&gt;", line 983, in _find_and_load
  File "&lt;frozen importlib._bootstrap&gt;", line 967, in _find_and_load_unlocked
  File "&lt;frozen importlib._bootstrap&gt;", line 677, in _load_unlocked
  File "&lt;frozen importlib._bootstrap_external&gt;", line 728, in exec_module
  File "&lt;frozen importlib._bootstrap&gt;", line 219, in _call_with_frames_removed
  File "C:\Python37\Lib\site-packages\matplotlib\backends\backend_qtagg.py", line 12, in &lt;module&gt;
    from .backend_qt import (
  File "C:\Python37\Lib\site-packages\matplotlib\backends\backend_qt.py", line 76, in &lt;module&gt;
    for mod, key in [
  File "C:\Python37\Lib\site-packages\matplotlib\backends\backend_qt.py", line 76, in &lt;listcomp&gt;
    for mod, key in [
TypeError: int() argument must be a string, a bytes-like object or a number, not 'KeyboardModifier'
</code></pre></div>
<h3 dir="auto">Code for reproduction</h3>
<div class="highlight highlight-source-python notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="import matplotlib.pyplot as plt
import numpy as np

x = np.array([1, 2, 3, 4, 5, 6, 7, 8])
y = np.array([1, 4, 9, 16, 7, 11, 23, 18])

plt.scatter(x, y)
plt.show()"><pre class="notranslate"><span class="pl-k">import</span> <span class="pl-s1">matplotlib</span>.<span class="pl-s1">pyplot</span> <span class="pl-k">as</span> <span class="pl-s1">plt</span>
<span class="pl-k">import</span> <span class="pl-s1">numpy</span> <span class="pl-k">as</span> <span class="pl-s1">np</span>

<span class="pl-s1">x</span> <span class="pl-c1">=</span> <span class="pl-s1">np</span>.<span class="pl-en">array</span>([<span class="pl-c1">1</span>, <span class="pl-c1">2</span>, <span class="pl-c1">3</span>, <span class="pl-c1">4</span>, <span class="pl-c1">5</span>, <span class="pl-c1">6</span>, <span class="pl-c1">7</span>, <span class="pl-c1">8</span>])
<span class="pl-s1">y</span> <span class="pl-c1">=</span> <span class="pl-s1">np</span>.<span class="pl-en">array</span>([<span class="pl-c1">1</span>, <span class="pl-c1">4</span>, <span class="pl-c1">9</span>, <span class="pl-c1">16</span>, <span class="pl-c1">7</span>, <span class="pl-c1">11</span>, <span class="pl-c1">23</span>, <span class="pl-c1">18</span>])

<span class="pl-s1">plt</span>.<span class="pl-en">scatter</span>(<span class="pl-s1">x</span>, <span class="pl-s1">y</span>)
<span class="pl-s1">plt</span>.<span class="pl-en">show</span>()</pre></div>
<h3 dir="auto">Actual outcome</h3>
<p dir="auto">Traceback (most recent call last): File "dt.py", line 14, in  plt.scatter(x, y, s=area, c=colors, alpha=0.5) File "C:\Python37\Lib\site-packages\matplotlib\pyplot.py", line 2817, in scatter __ret = gca().scatter( File "C:\Python37\Lib\site-packages\matplotlib\pyplot.py", line 2272, in gca return gcf().gca(**kwargs) File "C:\Python37\Lib\site-packages\matplotlib\pyplot.py", line 865, in gcf return figure() File "C:\Python37\Lib\site-packages\matplotlib\pyplot.py", line 809, in figure FigureClass=FigureClass, **kwargs) File "C:\Python37\Lib\site-packages\matplotlib\pyplot.py", line 324, in new_figure_manager _warn_if_gui_out_of_main_thread() File "C:\Python37\Lib\site-packages\matplotlib\pyplot.py", line 314, in _warn_if_gui_out_of_main_thread if (_get_required_interactive_framework(_get_backend_mod()) File "C:\Python37\Lib\site-packages\matplotlib\pyplot.py", line 217, in _get_backend_mod switch_backend(dict.<strong>getitem</strong>(rcParams, "backend")) File "C:\Python37\Lib\site-packages\matplotlib\pyplot.py", line 262, in switch_backend switch_backend(candidate) File "C:\Python37\Lib\site-packages\matplotlib\pyplot.py", line 282, in switch_backend class backend_mod(matplotlib.backend_bases.<em>Backend): File "C:\Python37\Lib\site-packages\matplotlib\pyplot.py", line 283, in backend_mod locals().update(vars(importlib.import_module(backend_name))) File "C:\Python37\lib\importlib_<em>init</em></em>.py", line 127, in import_module return _bootstrap._gcd_import(name[level:], package, level) File "", line 1006, in _gcd_import File "", line 983, in _find_and_load File "", line 967, in _find_and_load_unlocked File "", line 677, in _load_unlocked File "", line 728, in exec_module File "", line 219, in _call_with_frames_removed File "C:\Python37\Lib\site-packages\matplotlib\backends\backend_qtagg.py", line 12, in  from .backend_qt import ( File "C:\Python37\Lib\site-packages\matplotlib\backends\backend_qt.py", line 76, in  for mod, key in [ File "C:\Python37\Lib\site-packages\matplotlib\backends\backend_qt.py", line 76, in  for mod, key in [ TypeError: int() argument must be a string, a bytes-like object or a number, not 'KeyboardModifier'</p>
<h3 dir="auto">Expected outcome</h3>
<p dir="auto">Scatter draw</p>
<h3 dir="auto">Additional information</h3>
<p dir="auto"><em>No response</em></p>
<h3 dir="auto">Operating system</h3>
<p dir="auto">Windows</p>
<h3 dir="auto">Matplotlib Version</h3>
<p dir="auto">3.5.3</p>
<h3 dir="auto">Matplotlib Backend</h3>
<p dir="auto">Traceback (most recent call last):   File "", line 1, in    File "C:\Python37\Lib\site-packages\matplotlib_<em>init</em>_.py", line 1172, in get_backend     return rcParams['backend']   File "C:\Python37\Lib\site-packages\matplotlib_<em>init</em>_.py", line 674, in <strong>getitem</strong>     plt.switch_backend(rcsetup._auto_backend_sentinel)   File "C:\Python37\Lib\site-packages\matplotlib\pyplot.py", line 262, in switch_backend     switch_backend(candidate)   File "C:\Python37\Lib\site-packages\matplotlib\pyplot.py", line 282, in switch_backend     class backend_mod(matplotlib.backend_bases.<em>Backend):   File "C:\Python37\Lib\site-packages\matplotlib\pyplot.py", line 283, in backend_mod     locals().update(vars(importlib.import_module(backend_name)))   File "C:\Python37\lib\importlib_<em>init</em></em>.py", line 127, in import_module     return _bootstrap._gcd_import(name[level:], package, level)   File "", line 1006, in _gcd_import   File "", line 983, in _find_and_load   File "", line 967, in _find_and_load_unlocked   File "", line 677, in _load_unlocked   File "", line 728, in exec_module   File "", line 219, in _call_with_frames_removed   File "C:\Python37\Lib\site-packages\matplotlib\backends\backend_qtagg.py", line 12, in      from .backend_qt import (   File "C:\Python37\Lib\site-packages\matplotlib\backends\backend_qt.py", line 76, in      for mod, key in [   File "C:\Python37\Lib\site-packages\matplotlib\backends\backend_qt.py", line 76, in      for mod, key in [ TypeError: int() argument must be a string, a bytes-like object or a number, not 'KeyboardModifier'</p>
<h3 dir="auto">Python version</h3>
<p dir="auto">3.7.0</p>
<h3 dir="auto">Jupyter version</h3>
<p dir="auto"><em>No response</em></p>
<h3 dir="auto">Installation</h3>
<p dir="auto">pip</p>
<h3 dir="auto">Bug summary</h3>
<p dir="auto"></p><div class="Box Box--condensed my-2">
  <div class="Box-header f6">
    <p class="mb-0 text-bold">
      <a href="https://github.com/matplotlib/matplotlib/blob/318b2348f7127efc3e28aadebf762aae32b6343c/lib/matplotlib/backends/qt_compat.py#L144">matplotlib/lib/matplotlib/backends/qt_compat.py</a>
    </p>
    <p class="mb-0 color-fg-muted">
         Line 144
      in
      <a data-pjax="true" class="commit-tease-sha" href="/matplotlib/matplotlib/commit/318b2348f7127efc3e28aadebf762aae32b6343c">318b234</a>
    </p>
  </div>
  <div itemprop="text" class="Box-body p-0 blob-wrapper blob-wrapper-embedded data">
    <table class="highlight tab-size mb-0 js-file-line-container" data-tab-size="8" data-paste-markdown-skip="">

        <tbody><tr class="border-0">
          <td id="L144" class="blob-num border-0 px-3 py-0 color-bg-default" data-line-number="144"></td>
          <td id="LC144" class="blob-code border-0 px-3 py-0 color-bg-default blob-code-inner js-file-line"> <span class="pl-s1">_to_int</span> <span class="pl-c1">=</span> <span class="pl-s1">operator</span>.<span class="pl-en">attrgetter</span>(<span class="pl-s">"value"</span>) <span class="pl-k">if</span> <span class="pl-v">QT_API</span> <span class="pl-c1">==</span> <span class="pl-s">"PyQt6"</span> <span class="pl-k">else</span> <span class="pl-s1">int</span> </td>
        </tr>
    </tbody></table>
  </div>
</div>
<p></p>
<p dir="auto">Have to check for "PySide6" too.</p>
<h3 dir="auto">Code for reproduction</h3>
<div class="highlight highlight-source-python notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="$ QT_API=pyside6 python -c &quot;import matplotlib.backends.backend_qt5agg&quot;"><pre class="notranslate">$ <span class="pl-v">QT_API</span><span class="pl-c1">=</span><span class="pl-s1">pyside6</span> <span class="pl-s1">python</span> <span class="pl-c1">-</span><span class="pl-s1">c</span> <span class="pl-s">"import matplotlib.backends.backend_qt5agg"</span></pre></div>
<h3 dir="auto">Actual outcome</h3>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="Traceback (most recent call last):
  File &quot;&lt;string&gt;&quot;, line 1, in &lt;module&gt;
  File &quot;/tmp/tmp.atoQSuHf68/venv/lib/python3.10/site-packages/matplotlib/backends/backend_qt5agg.py&quot;, line 7, in &lt;module&gt;
    from .backend_qtagg import (    # noqa: F401, E402 # pylint: disable=W0611
  File &quot;/tmp/tmp.atoQSuHf68/venv/lib/python3.10/site-packages/matplotlib/backends/backend_qtagg.py&quot;, line 12, in &lt;module&gt;
    from .backend_qt import QtCore, QtGui, _BackendQT, FigureCanvasQT
  File &quot;/tmp/tmp.atoQSuHf68/venv/lib/python3.10/site-packages/matplotlib/backends/backend_qt.py&quot;, line 72, in &lt;module&gt;
    _MODIFIER_KEYS = [
  File &quot;/tmp/tmp.atoQSuHf68/venv/lib/python3.10/site-packages/matplotlib/backends/backend_qt.py&quot;, line 73, in &lt;listcomp&gt;
    (_to_int(getattr(_enum(&quot;QtCore.Qt.KeyboardModifier&quot;), mod)),
TypeError: int() argument must be a string, a bytes-like object or a real number, not 'KeyboardModifier'"><pre class="notranslate"><code class="notranslate">Traceback (most recent call last):
  File "&lt;string&gt;", line 1, in &lt;module&gt;
  File "/tmp/tmp.atoQSuHf68/venv/lib/python3.10/site-packages/matplotlib/backends/backend_qt5agg.py", line 7, in &lt;module&gt;
    from .backend_qtagg import (    # noqa: F401, E402 # pylint: disable=W0611
  File "/tmp/tmp.atoQSuHf68/venv/lib/python3.10/site-packages/matplotlib/backends/backend_qtagg.py", line 12, in &lt;module&gt;
    from .backend_qt import QtCore, QtGui, _BackendQT, FigureCanvasQT
  File "/tmp/tmp.atoQSuHf68/venv/lib/python3.10/site-packages/matplotlib/backends/backend_qt.py", line 72, in &lt;module&gt;
    _MODIFIER_KEYS = [
  File "/tmp/tmp.atoQSuHf68/venv/lib/python3.10/site-packages/matplotlib/backends/backend_qt.py", line 73, in &lt;listcomp&gt;
    (_to_int(getattr(_enum("QtCore.Qt.KeyboardModifier"), mod)),
TypeError: int() argument must be a string, a bytes-like object or a real number, not 'KeyboardModifier'
</code></pre></div>
<h3 dir="auto">Expected outcome</h3>
<p dir="auto">no errors</p>
<h3 dir="auto">Additional information</h3>
<p dir="auto">PySide6==6.4.0</p>
<h3 dir="auto">Operating system</h3>
<p dir="auto">GNU\Gentoo Linux</p>
<h3 dir="auto">Matplotlib Version</h3>
<p dir="auto">3.6.1</p>
<h3 dir="auto">Matplotlib Backend</h3>
<p dir="auto">same exception</p>
<h3 dir="auto">Python version</h3>
<p dir="auto">3.10.6</p>
<h3 dir="auto">Jupyter version</h3>
<p dir="auto">not installed</p>
<h3 dir="auto">Installation</h3>
<p dir="auto">pip</p>