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.

Reply via email to