[prev in list] [next in list] [prev in thread] [next in thread]
List: pykde
Subject: Re: [PyKDE] qApp is a QApplication instance
From: "Giovanni Bajo" <rasky () develer ! com>
Date: 2005-03-21 16:01:32
Message-ID: 03d401c52e2f$3ff245f0$bf03030a () trilan
[Download RAW message or body]
Phil Thompson <phil@riverbankcomputing.co.uk> wrote:
>>>>> sys.modules['qt'].__dict__['qApp'] = A(sys.argv)
>>>>>
>>>>> ...might do it. You have to make sure that this is done before the
>>>>> other
>>>>> modules that want to use it get imported.
>> Well, I'm trying, but it's almost impossible to do it. By the time the
App
>> constructor has executed, many modules are imported already. Even putting
>> the sys.modules line at the top of A's constructor is not enough because
>> of
>> the fact that many modules are already imported. I even tried reload the
>> modules but that caused other problems.
>>
>> I understand that you consider this not stricly a bug. But there *is* a
>> need
>> to access the application from everywhere without passing it around, and
>> qApp exists exactly for that. In C++, you can downcast it to whatever app
>> type you defined and use it. This is impossible with PyQt.
>
> No it isn't - sip.cast()
What would the correct syntax would be, then?
def pyApp():
import sip
return sip.cast(qApp, App)
gives me a:
SystemError: error return without exception set
--
Giovanni Bajo
_______________________________________________
PyKDE mailing list PyKDE@mats.imk.fraunhofer.de
http://mats.imk.fraunhofer.de/mailman/listinfo/pykde
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic