<HTML>
<HEAD>
<TITLE>Re: [PyQt] QCoreApplication::exec: The event loop is already running</TITLE>
</HEAD>
<BODY>
<FONT FACE="Calibri, Verdana, Helvetica, Arial"><SPAN STYLE='font-size:11pt'>When you start another mainwindow (or top level widget for that matter) you don&#8217;t need to call exec_ or make another QApplication.<BR>
<BR>
The way I normally import things like this is the following:<BR>
<BR>
Foo.py<BR>
<BR>
class MainWindow()...<BR>
...<BR>
<BR>
def Start():<BR>
&nbsp;&nbsp;&nbsp;&nbsp;m = MainWindow()<BR>
&nbsp;&nbsp;&nbsp;&nbsp;m.show()<BR>
<BR>
if __name__ == &#8220;__main__&#8221;:<BR>
&nbsp;&nbsp;import sys<BR>
&nbsp;&nbsp;app = QApplication(sys.argv)<BR>
&nbsp;&nbsp;Start()<BR>
&nbsp;&nbsp;app.exec_()<BR>
<BR>
<BR>
To start the application from the command line,<BR>
<BR>
python Foo.py<BR>
<BR>
And to load it from another modele, Bar.<BR>
<BR>
import Foo<BR>
Foo.Start()<BR>
<BR>
Brian<BR>
<BR>
On 3/2/09 1:38 PM, &quot;Brent Villalobos&quot; &lt;<a href="Brent.Villalobos@pdi.dreamworks.com">Brent.Villalobos@pdi.dreamworks.com</a>&gt; wrote:<BR>
<BR>
</SPAN></FONT><BLOCKQUOTE><FONT FACE="Calibri, Verdana, Helvetica, Arial"><SPAN STYLE='font-size:11pt'>I have a pyqt application that imports and runs another pyqt<BR>
application. &nbsp;I am not launching the second application in its own<BR>
process, but I'm just relying on python's module importing<BR>
architecture. &nbsp;Both applications seems to run fine without any problems,<BR>
but I'm seeing this warning message:<BR>
&nbsp;&nbsp;&nbsp;&nbsp;QCoreApplication::exec: The event loop is already running<BR>
<BR>
While everything seems to run fine I feel like I'm doing something wrong<BR>
and I will eventually be bitten by some odd side effect. &nbsp;Are these<BR>
fears warranted? &nbsp;I know that the Qt documentation says that you should<BR>
only have one QApplication instance so is this just warning and Qt is<BR>
doing the right thing &quot;under the hood?&quot;<BR>
<BR>
If this will create problems, can you provide some suggestions on what I<BR>
should do differently? &nbsp;I want to avoid launching a second process if<BR>
possible. &nbsp;Is it possible for one QApplication instance to manage<BR>
multiple gui applications without problems?<BR>
<BR>
Finally, if there is no problem is there a way I can suppress that<BR>
warning so that users don't freak out? &nbsp;Thanks.<BR>
-Brent<BR>
_______________________________________________<BR>
PyQt mailing list &nbsp;&nbsp;&nbsp;<a href="PyQt@riverbankcomputing.com">PyQt@riverbankcomputing.com</a><BR>
<a href="http://www.riverbankcomputing.com/mailman/listinfo/pyqt">http://www.riverbankcomputing.com/mailman/listinfo/pyqt</a><BR>
<BR>
</SPAN></FONT></BLOCKQUOTE>
</BODY>
</HTML>