Skip to content
Advertisement

Error “QObject::startTimer: QTimer can only be used with threads started with QThread” many times when closing application

I know this has been asked many times before. I read all of those threads, and my case seems different. Everybody else who has this trouble has a few straightforward causes that I think I’ve ruled out, such as:

  • Starting a timer with no event loop running
  • Starting/stopping a timer from a thread other than the one that created the timer
  • Failing to set the parent property of a widget, leading to problems with the order of destruction

Below I have a minimal code sample that demonstrates the problem. Notice that I’ve started no threads or timers. I also have set the parent of every widget. If I remove the graph widgets, the problem goes away, so one is tempted to blame pyQtGraph, however, if I include the plot widgets but exclude all the blank tabs (i.e. every tab except tabCatchaTiger), the problem also goes away, and that seems to vindicate pyQtGraph.

Versions:

  • Windows 7
  • Python 2.7.8
  • Wing IDE 5.0.9-1
  • PyQt 4.11.1
  • PyQwt 5.2.1
  • PyQtGraph 0.9.8

Test case:

JavaScript

Advertisement

Answer

Personally, I don’t put any effort into chasing exit crashes anymore–just use pg.exit() and be done with it.

(but if you do happen to find a bug in pyqtgraph, don’t hesitate to open an issue on github)

User contributions licensed under: CC BY-SA
2 People found this is helpful
Advertisement