Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

'NoneType' object has no attribute 'removeItem' #2973

Open
mbshqqb opened this issue Mar 29, 2024 · 1 comment
Open

'NoneType' object has no attribute 'removeItem' #2973

mbshqqb opened this issue Mar 29, 2024 · 1 comment

Comments

@mbshqqb
Copy link

mbshqqb commented Mar 29, 2024

here is my code:

plotItem = pg.PlotItem()
plotItem.setAxisItems(axisItems={'bottom':pg.AxisItem('bottom')})

when I run this code, it shows the error as below

Traceback (most recent call last):
  File "E:\Workspace\Python\VNPY-master\examples\candle_chart\tick\item\main.py", line 42, in <module>
    plotItem.setAxisItems(axisItems={'bottom':pg.AxisItem('bottom')})
  File "E:\home\.conda\envs\Python310\lib\site-packages\pyqtgraph\graphicsItems\PlotItem\PlotItem.py", line 312, in setAxisItems
    oldAxis.scene().removeItem(oldAxis)
AttributeError: 'NoneType' object has no attribute 'removeItem'
@j9ac9k
Copy link
Member

j9ac9k commented Apr 28, 2024

This happens when the QGraphicsScene isn't set. Often this is the case when trying to modify widgets too early, like before calling QApplication.exec() or before calling QWidget.show().

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants