Hello Wahabo.

Maybe is better to start with the lower number of imports at the beginning
and add it later, if needed, after you have a working-well initial release.
This code is working for me (I also removed super-class):



import pyqtgraph as pg
import numpy as np
import sys

class Window(pg.Qt.QtGui.QMainWindow):
    def __init__(self, parent=None, flags=pg.Qt.QtCore.Qt.WindowFlags()):
        pg.Qt.QtGui.QMainWindow.__init__(self, flags=flags)

        self.a = []
        self.b = []
        self.x = []
        self.y = []

        self.mapper = pg.Qt.QtCore.QSignalMapper()

        self.Widget = pg.Qt.QtGui.QWidget()
        self.setCentralWidget(self.Widget)

        self.Layout_widget =  pg.Qt.QtGui.QGridLayout()
        self.Widget.setLayout(self.Layout_widget)

        self.groupbox = pg.Qt.QtGui.QGroupBox(self.Widget)
       # self.groupbox.setCheckable(True)
       # self.groupbox.clicked.connect(self.Afficher)

        self.groupbox_layout = pg.Qt.QtGui.QVBoxLayout()
        self.groupbox.setLayout(self.groupbox_layout)

        self.canva = pg.GraphicsWindow()
       # self.graph_1 = self.canva.addPlot(title="Basic array plotting")

        self.Layout_widget.addWidget(self.groupbox)
        self.Layout_widget.addWidget(self.canva)

        self.Checkbox = []
        for i in range (3):
            checkbox = pg.Qt.QtGui.QCheckBox("Capteur {0}".format(i))
            checkbox.stateChanged.connect(self.Afficher)
            self.Checkbox.append(checkbox)

        for i in range(3):
            self.groupbox_layout.addWidget(self.Checkbox[i])

        self.x1 = np.linspace(0,20,10)
        self.y1 =  np.arange(0,10)
        self.x.append(self.x1)
        self.y.append(self.y1)

        self.x2 = np.arange(0,10)
        self.y2 = np.linspace(0,20,10)
        self.x.append(self.x2)
        self.y.append(self.y2)

        self.x3 = np.random.normal(size=10)
        self.y3 = [i**2 for i in range(10)]
        self.x.append(self.x3)
        self.y.append(self.y3)

    def Afficher(self):
        self.a = []
        b=self.sender()
        print(b.text())
        self.a.append(b)

        for i in range(len(self.a)):
            b =
self.canva.addPlot(title="{}".format(self.a[i].text()),row=0,col=i)
            self.b.append(b)

        for i in range(len(self.b)):
                self.b[i].plot(self.x[i],self.y[i])



if __name__ == "__main__":
    app = pg.Qt.QtGui.QApplication(sys.argv)
    w = Window()
    w.show()
    sys.exit(app.exec_())

On Mon, Apr 27, 2020 at 11:19 PM Wahabo Ouedraogo <
[email protected]> wrote:

> Hello,
> I have some difficults to configure pyqtgraph in my computer. when i run
> my code, i obtain this message:
>
> *PS C:\Users\ThinkPad> & python "d:/Bureau/VISUAL STUDIO
> CODE/Untitled_pyqtgraph.py"*
> *Traceback (most recent call last):*
> *  File "d:/Bureau/VISUAL STUDIO CODE/Untitled_pyqtgraph.py", line 102, in
> <module>*
> *    w = Window()*
> *  File "d:/Bureau/VISUAL STUDIO CODE/Untitled_pyqtgraph.py", line 40, in
> __init__*
> *    self.canva = pg.GraphicsWindow()*
> *AttributeError: module 'pyqtgraph' has no attribute 'GraphicsWindow'*
>
>
> My code is below.
>
>
>
> # -*- coding: utf-8 -*-
> """
> Created on Sat Apr 25 13:33:15 2020
>
> @author: ThinkPad
> """
>
> from PyQt5.QtCore import *
> from PyQt5.QtGui import *
> from PyQt5.QtWidgets import *
> import pyqtgraph as pg
> from pyqtgraph.Qt import QtGui, QtCore
> import numpy as np
> import sys
>
> class Window(QMainWindow):
>     def __init__(self, parent=None, flags=Qt.WindowFlags()):
>         super().__init__(parent=parent, flags=flags)
>
>         self.a = []
>         self.b = []
>         self.x = []
>         self.y = []
>
>         self.mapper = QSignalMapper()
>
>         self.Widget = QWidget()
>         self.setCentralWidget(self.Widget)
>
>         self.Layout_widget = QGridLayout()
>         self.Widget.setLayout(self.Layout_widget)
>
>         self.groupbox = QGroupBox(self.Widget)
>         #self.groupbox.setCheckable(True)
>        # self.groupbox.clicked.connect(self.Afficher)
>
>         self.groupbox_layout = QVBoxLayout()
>         self.groupbox.setLayout(self.groupbox_layout)
>
>         self.canva = pg.GraphicsWindow()
>        # self.graph_1 = self.canva.addPlot(title="Basic array plotting")
>
>         self.Layout_widget.addWidget(self.groupbox)
>         self.Layout_widget.addWidget(self.canva)
>
>         self.Checkbox = []
>         for i in range (3):
>             checkbox = QCheckBox("Capteur {0}".format(i))
>             checkbox.stateChanged.connect(self.Afficher)
>             self.Checkbox.append(checkbox)
>
>         for i in range(3):
>             self.groupbox_layout.addWidget(self.Checkbox[i])
>
>
>
>
>
>
>         self.x1 = np.linspace(0,20,10)
>         self.y1 =  np.arange(0,10)
>         self.x.append(self.x1)
>         self.y.append(self.y1)
>
>
>         self.x2 = np.arange(0,10)
>         self.y2 = np.linspace(0,20,10)
>         self.x.append(self.x2)
>         self.y.append(self.y2)
>
>         self.x3 = np.random.normal(size=10)
>         self.y3 = [i**2 for i in range(10)]
>         self.x.append(self.x3)
>         self.y.append(self.y3)
>
>
>     def Afficher(self):
>         self.a = []
>         b=self.sender()
>         print(b.text())
>         self.a.append(b)
>
>         for i in range(len(self.a)):
>             b = self.canva.addPlot(title="{}".format(self.a[i].text()),row
> =0,col=i)
>             self.b.append(b)
>
>         for i in range(len(self.b)):
>
>                 self.b[i].plot(self.x[i],self.y[i])
>
>
>
>
>
>
>
>
>
>
> if __name__ == "__main__":
>     app = QApplication(sys.argv)
>     w = Window()
>     w.show()
>     sys.exit(app.exec_())
>
>
>
>
> --
> You received this message because you are subscribed to the Google Groups
> "pyqtgraph" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/pyqtgraph/09177b5e-41de-454e-aa67-439de27eef81%40googlegroups.com
> <https://groups.google.com/d/msgid/pyqtgraph/09177b5e-41de-454e-aa67-439de27eef81%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"pyqtgraph" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/pyqtgraph/CAD_qyJqiL%3DpRx-tPsJ%3DeE7Mp4WGY567k_Yh%2Biq1_y0aDARf8Jg%40mail.gmail.com.

Reply via email to