AddWidget - Type error
Moved
Solved
Qt for Python
-
I'm trying to add a Widget to a vertical box (named 'qvb_grafico' based on Vertical layout) creted with QT Designer. In the line "self.window.qvb_grafico.addWidget(self.canvas)" I'm getting the error: Type error: argument 1 has unexpected type 'FigureCanvasAgg'
Any suggestion is welcome
Here below the piece of code:
from PyQt5 import uic
import matplotlib.pyplot as plt
from matplotlib.backends.backend_qt5agg import FigureCanvasAgg as FigureCanvas
from numpy import *class Grafico:
code_text ```numeroPunti = 200 def __init__(self, window): self.window=window self.figura=plt.figure() self.ax=self.figura.add_subplot(111) self.canvas=FigureCanvas(self.figura) self.window.qvb_grafico.addWidget(self.canvas) self.statoGriglia=False ....