class BMWidget(QWidget): def __init__(self, points, *args): super(BMWidget, self).__init__() self.setup(points, *args) def params(self, *args): return ( ('Lines', None), ('Dots', None), ) def setup(self, points, *args): x = np.linspace(.001, 20., points) y = (np.sin(x)/x)*np.cos(20*x) layout = QGridLayout() nbcol, col, row = 2, 0, 0 for style, symbol in self.params(*args): layout.addWidget(BMPlot(style, x, y, getattr(QwtPlotCurve, style), symbol=symbol), row, col) col += 1 if col >= nbcol: row +=1 col = 0 self.text = QLineEdit() self.text.setReadOnly(True) self.text.setAlignment(Qt.AlignCenter) self.text.setText("Rendering plot...") layout.addWidget(self.text, row+1, 0, 1, 2) self.setLayout(layout)