Greetings,

When i run my code, i obtain this error:

*Traceback (most recent call last):*
*  File "d:/Documents/VISUAL STUDIO CODE EXO/Untitled-f.py", line 58, in 
<module>*
*    w = Window()*
*  File "d:/Documents/VISUAL STUDIO CODE EXO/Untitled-f.py", line 49, in 
__init__*
*    self.dockArea = pg.DockArea()*
*AttributeError: module 'pyqtgraph' has no attribute 'DockArea'*
*PS D:\Documents\VISUAL STUDIO CODE EXO\MEMOIRE> & 
C:/Users/ThinkPad/AppData/Local/Programs/Python/Python38/python.exe 
"d:/Documents/VISUAL STUDIO CODE EXO/Untitled-f.py"*
*PS D:\Documents\VISUAL STUDIO CODE EXO\MEMOIRE> *

*here, the script:*


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 random
import sys

class Window(QtGui.QWidget):
    
    def __init__(self,parent = None):
        
        QtGui.QWidget.__init__(self,parent)
        pg.setConfigOptions(antialias=True)
        pg.setConfigOptions(background = "k")
        
        self.setParent(parent)
    
        data = np.random.normal(size=(50, 60))
        data = data.ravel()
        self.x1 = np.linspace(0,20,10)
        self.y1 =  np.arange(0,10)
        
        self.x = np.linspace(0,15,10)

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

        N = 600
        T = 1.0 / 800.0
        xa = np.linspace(0.0, N*T, N)
        ya = np.sin(50.0 * 2.0*np.pi*xa) + 0.5*np.sin(80.0 * 2.0*np.pi*xa)
        
        Y = np.sin(np.linspace(0, 20, 600))
        self.plot = pg.PlotItem()
        self.plot.plot(self.x1,self.y2)
        self.plot.plot(y=ya)
        self.plot.plot(Y,pen = pg.mkPen(color = 'r'))
        self.plot.showButtons()
        
        self.plot2 = pg.PlotItem()
        self.plot2.plot(self.x1, self.y2,pen=pg.mkPen(cosmetic=True,color=
"r",width=2))
        self.plot2.plot(self.x1,self.x2)
        self.plot2.plot(self.y1,self.y2)
        self.plot2.scatterPlot(self.y2,self.x)

        self.dockArea = pg.DockArea()

        self.graphicslayouwidget = pg.GraphicsLayoutWidget()
        self.graphicslayouwidget.addItem(self.plot)
        self.graphicslayouwidget.addItem(self.plot2)

        self.graphicslayouwidget.show()
    
if __name__ == "__main__":
    app = QApplication(sys.argv)
    w = Window()
    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/0f616c3c-0444-4c4f-a442-d81a58f12b52%40googlegroups.com.

Reply via email to