Python Forum
TypeError: isdeleted() argument 1 must be sip.simplewrapper, not PlotWidget
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
TypeError: isdeleted() argument 1 must be sip.simplewrapper, not PlotWidget
#1
Hi,

I'm trying to do my first steps in programming a gui in PyQt5.
In general I want to plot data in a 'x' and 'y' graph. To do so I want to use PyQtGraph.

I started my own programming but while compiling I always got the error message

'TypeError: isdeleted() argument 1 must be sip.simplewrapper, not PlotWidget'

I first thought that it's my fault but then I've tried a lot of examples of the PyQtGraph GitHUb page.
No matter which code I use, I alwas get this error. For example I've tried this code

import pyqtgraph as pg
from pyqtgraph.Qt import QtCore, QtGui
import numpy as np

pg.mkQApp()

pw = pg.PlotWidget()
pw.show()
pw.setWindowTitle('pyqtgraph example: MultiplePlotAxes')
p1 = pw.plotItem
p1.setLabels(left='axis 1')

## create a new ViewBox, link the right axis to its coordinate system
p2 = pg.ViewBox()
p1.showAxis('right')
p1.scene().addItem(p2)
p1.getAxis('right').linkToView(p2)
p2.setXLink(p1)
p1.getAxis('right').setLabel('axis2', color='#0000ff')

## create third ViewBox. 
## this time we need to create a new axis as well.
p3 = pg.ViewBox()
ax3 = pg.AxisItem('right')
p1.layout.addItem(ax3, 2, 3)
p1.scene().addItem(p3)
ax3.linkToView(p3)
p3.setXLink(p1)
ax3.setZValue(-10000)
ax3.setLabel('axis 3', color='#ff0000')


## Handle view resizing 
def updateViews():
    ## view has resized; update auxiliary views to match
    global p1, p2, p3
    p2.setGeometry(p1.vb.sceneBoundingRect())
    p3.setGeometry(p1.vb.sceneBoundingRect())
    
    ## need to re-update linked axes since this was called
    ## incorrectly while views had different shapes.
    ## (probably this should be handled in ViewBox.resizeEvent)
    p2.linkedViewChanged(p1.vb, p2.XAxis)
    p3.linkedViewChanged(p1.vb, p3.XAxis)

updateViews()
p1.vb.sigResized.connect(updateViews)


p1.plot([1,2,4,8,16,32])
p2.addItem(pg.PlotCurveItem([10,20,40,80,40,20], pen='b'))
p3.addItem(pg.PlotCurveItem([3200,1600,800,400,200,100], pen='r'))

## Start Qt event loop unless running in interactive mode or using pyside.
if __name__ == '__main__':
    import sys
    if (sys.flags.interactive != 1) or not hasattr(QtCore, 'PYQT_VERSION'):
        QtGui.QApplication.instance().exec_()
So what does it mean? I'm working on Win64 and Anaconda/Spyder.

Thanks a lot for your help.

Johna
Reply
#2
I have the same issue, all the examples crash Python and the console shows an endless stream of errors, like :

File "C:\Python\Python37\lib\site-packages\pyqtgraph\graphicsItems\GraphicsObject.py", line 40, in itemChange
ret = sip.cast(ret, QtGui.QGraphicsItem)
TypeError: cast() argument 1 must be sip.simplewrapper, not PlotItem
TypeError: isdeleted() argument 1 must be sip.simplewrapper, not ViewBox


I've tried reinstalling sip and PyQt5==5.12.0/1/2 - 5.15, but no luck. Interestingly, aside from your post, I haven't found anyone else have this problem!

>>> from PyQt5 import QCore, QtGui, QtWidgets, uic
>>> from PyQt5.QtWidgets import QApplication
>>> import pyqtgraph as pg
>>> pg.__version__
'0.11.1'
>>> app = QtGui.QApplication([])
>>> pg.plot()
Reply
#3
The PyQtGraph examples in the documentation look nothing like the posted code. For example:
from PyQt5 import QtGui  # (the example applies equally well to PySide2)
import pyqtgraph as pg

## Always start by initializing Qt (only once per application)
app = QtGui.QApplication([])
Important things like QApplication come from PyQt5 or PySideX, not from pyqtgraph.

And what does "pg.mkQApp()" do? I can't find this call anywhere in the API.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Syntax Error: Positional argument follows keyword argument Rama02 3 4,022 Feb-09-2021, 06:10 PM
Last Post: deanhystad

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020