“Must construct a QApplication before a QPaintDevice” from QWidget

前端 未结 2 1551
余生分开走
余生分开走 2020-11-30 11:51

I\'m busy porting an IRC client from Python 2.6 to 3.3 and I\'ve stumbled across a problem with PyQt. The application originally used PyQt4, I\'m also recoding it to get it

2条回答
  •  轻奢々
    轻奢々 (楼主)
    2020-11-30 12:38

    The error message is pretty clear: you are trying to draw a QWidget (which in PyQt4.5 inherits QPaintDevice and QObject) before you instantiate the QApplication. But your code is too large for reading it line by line. Try to isolate the error building a small application and adding functionality step by step. Or use a debugger (IDEs like Eclipse + PyDev are supposed to be able to debug your app). Or provide us with a small, self contained example of the problem.

提交回复
热议问题