Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TypeError in matplotlib demo #18

Open
igurin-invn opened this issue Aug 13, 2024 · 0 comments
Open

TypeError in matplotlib demo #18

igurin-invn opened this issue Aug 13, 2024 · 0 comments

Comments

@igurin-invn
Copy link

This issue applies to this page: https://www.pythonguis.com/tutorials/pyside6-plotting-matplotlib/

I used this example earlier this year to make a successful GUI (thanks!). I started working on a new GUI, and got a really persistent error:

TypeError: 'PySide6.QtWidgets.QBoxLayout.addWidget' called with wrong argument types:
  PySide6.QtWidgets.QBoxLayout.addWidget(MplCanvas)
Supported signatures:
  PySide6.QtWidgets.QBoxLayout.addWidget(PySide6.QtWidgets.QWidget, int = 0, PySide6.QtCore.Qt.AlignmentFlag = Default(Qt.Alignment))

I eventually found that the matplotlib docs (here) recommend something different:

from matplotlib.backends.backend_qtagg import FigureCanvas

class MplCanvas(FigureCanvas):
    ...

When I changed the data type accordingly, the error went away.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant