[prev in list] [next in list] [prev in thread] [next in thread]
List: pykde
Subject: Re: [PyQt] QCoreApplication::exec: The event loop is already running
From: Giovanni Bajo <rasky () develer ! com>
Date: 2009-03-03 0:25:43
Message-ID: 1236039943.9064.23.camel () ozzu
[Download RAW message or body]
On lun, 2009-03-02 at 11:12 -0800, Brent Villalobos wrote:
> Brian Kelley wrote:
> > When you start another mainwindow (or top level widget for that
> > matter) you don't need to call exec_ or make another QApplication.
>
> That's good. Along those same lines does Qt provide a way of querying
> whether a QApplication loop is already running so you can avoid making a
> new one?
Why don't you simply reorganize the code a bit so to provide another
entry point which doesn't create your application? Any PyQt application
should have a main no more complicated than this:
if __name__ == "__main__":
app = QApplication([])
w = MySuperMainWidget()
w.show()
app.exec_()
just add a function like this:
def entry():
global w
w = MySuperMainWidget()
w.show()
and you're done with it.
--
Giovanni Bajo
Develer S.r.l.
http://www.develer.com
_______________________________________________
PyQt mailing list PyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic