QPaintDevice: Must construct a QApplication before a QPaintDevice

boris.smirnov at gmail.com boris.smirnov at gmail.com
Wed Feb 28 04:00:46 EST 2007


On Feb 28, 9:07 am, boris.smir... at gmail.com wrote:
> On Feb 28, 8:56 am, Phil Thompson <p... at riverbankcomputing.co.uk>
> wrote:
>
> > On Tuesday 27 February 2007 11:09 pm, shredwheat wrote:
>
> > > When your programs stops with the error, it should also be printing a
> > > stack trace. This is a list of all the functions that have been called
> > > when Python had the problem.
>
> > > You shouldn't have to do anything extra to get the stack trace.
>
> > The error is raised in Qt and aborts immediately. It never gets back to Python
> > to generate a trace.
>
> > He needs to produce a short and complete test which demonstrates the problem,
> > then we can point out where the QPaintDevice is being created.
>
> > Phil
>
> OK, but before I do a complete test, could anybody tell/explain me why
> the same file is working on Windows?
> Did anybody already meet with something similar Win vs. Linux?
>
> b.

Here is my simple script:

import sys
from qt import *
class Optimizer(QWidget):
   def __init__(self, parent = 0):
      QWidget.__init__(self)
      QGridLayout(self)
if __name__ == '__main__':
   a = QApplication (sys.argv)
   mywidget = Optimizer()
   a.exec_loop()

This produces this:
> python qt_script_bs_070228.py
QPaintDevice: Must construct a QApplication before a QPaintDevice

Any suggestions here?
Thanks



BTW: One question:
when I use "import qt" instead of "from qt import *" I get this error:
Traceback (most recent call last):
  File "mscarideidtool_bs_070228.py", line 4, in ?
    class Optimizer(QWidget):
NameError: name 'QWidget' is not defined

What is the difference between "import qt" and "from qt import *" ? I
thought that these are the same.




More information about the Python-list mailing list