Thanks to visit codestin.com
Credit goes to github.com

Skip to content

[Bug]: import matplotlib.backends.backend_qt5agg error for pyside6 #24212

Closed
@koutoftimer

Description

@koutoftimer

Bug summary

_to_int = operator.attrgetter("value") if QT_API == "PyQt6" else int

Have to check for "PySide6" too.

Code for reproduction

$ QT_API=pyside6 python -c "import matplotlib.backends.backend_qt5agg"

Actual outcome

Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/tmp/tmp.atoQSuHf68/venv/lib/python3.10/site-packages/matplotlib/backends/backend_qt5agg.py", line 7, in <module>
    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 <module>
    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 <module>
    _MODIFIER_KEYS = [
  File "/tmp/tmp.atoQSuHf68/venv/lib/python3.10/site-packages/matplotlib/backends/backend_qt.py", line 73, in <listcomp>
    (_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'

Expected outcome

no errors

Additional information

PySide6==6.4.0

Operating system

GNU\Gentoo Linux

Matplotlib Version

3.6.1

Matplotlib Backend

same exception

Python version

3.10.6

Jupyter version

not installed

Installation

pip

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions