hi 
I am trying to use a button in the menu of my window to add another dock to 
my dock area. ( see file attached)
The widget gets added and it seems to function but i get the following 
error:   

AttributeError: 'NoneType' object has no attribute 'type'
Traceback (most recent call last):
..pyqtgraph\dockarea\Dock.py", line 170, in resizeEvent
    self.setOrientation()
..\pyqtgraph\dockarea\Dock.py", line 143, in setOrientation
    if self.container().type() == 'tab':
AttributeError: 'NoneType' object has no attribute 'type'

The error does not happen if the main window is empty ( for the 1st widget 
you add), but the following ones do the same
can anybody help? 

-- 
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/26e4b145-b6d5-44fc-a1c6-26759efe3c5c%40googlegroups.com.
import pyqtgraph as pg
from pyqtgraph.Qt import QtCore, QtGui
from pyqtgraph.dockarea import *
from PySide2.QtWidgets import QWidget, QMainWindow

count =0


def addWidgetToWindow():

    mywidget = QWidget()
    mywidget.setStyleSheet("background-color : red;")
    global count
    mywidget.setWindowTitle("my widget"+str(count))
    d = Dock( name=mywidget.windowTitle(), size=(300, 200), closable=True)
    global area
    area.addDock(d, "left")
    d.addWidget(mywidget)
    count= count+1


if __name__ == '__main__':
    import sys
    global area

    app = QtGui.QApplication([])
    win = QMainWindow()
    area = DockArea()
    win.setCentralWidget(area)
    win.resize(1000, 500)

    menu = win.menuBar()
    AddWidget_act = menu.addAction("AddWidget")
    AddWidget_act.triggered.connect(addWidgetToWindow)

    addWidgetToWindow()
    addWidgetToWindow()


    win.show()

    if (sys.flags.interactive != 1) or not hasattr(QtCore, 'PYQT_VERSION'):
        QtGui.QApplication.instance().exec_()

Reply via email to