QPaintDevice: Must construct a QApplication before a QPaintDevice

boris.smirnov at gmail.com boris.smirnov at gmail.com
Wed Feb 28 04:58:42 EST 2007


On Feb 28, 10:45 am, Phil Thompson <p... at riverbankcomputing.co.uk>
wrote:
> On Wednesday 28 February 2007 9:26 am, boris.smir... at gmail.com wrote:
>
>
>
>
>
> > On Feb 28, 10:22 am, Phil Thompson <p... at riverbankcomputing.co.uk>
>
> > wrote:
> > > On Wednesday 28 February 2007 9:00 am, boris.smir... at gmail.com wrote:
> > > > 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?
>
> > > It works fine for me.
>
> > > > 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.
>
> > > The first creates a new namespace called "qt" and imports the module's
> > > objects into it. To reference those objects you have to include the
> > > namespace name.
>
> > > The second imports the module's objects into the current namespace.
>
> > > Phil- Hide quoted text -
>
> > > - Show quoted text -
>
> > OK, I have to apologize because I didn't mention that I use python
> > version 2.2.1, could it be the problem here? Bugs or something? I have
> > to use this version since it was delivered with a software that we use
> > here.
>
> So what versions of Qt, PyQt and SIP are you using? Were these included with
> the software you are using? If so, what is that software?
>
> Phil- Hide quoted text -
>
> - Show quoted text -

Stupid question but how can I find out what are the versions of those?
I only found qt.py file and there was this:
# Generated by SIP 3.3 (build 25) on Fri Jul 26 12:44:13 2002
The version of PyQt and SIP can't find out, but there is a directory
PyQt wit .pyc files and SIP.h file.

The sofware is MSC.ADAMS from msc.software

b.




More information about the Python-list mailing list