[PyQt] QApplication was not created in the main()

Gelonida N gelonida at gmail.com
Mon Jul 28 15:14:57 BST 2014


Hi Alan,


On 7/26/2014 7:35 PM, Alan Ezust wrote:
> You are only supposed to create one QApplication, and that should be
> main. Why do you want to create a second one somewhere else? That is
> probably a mistake.

I think I did not express myself very well.

I do not want to create a second instance of a QApplication.
I just want to know whether I can create an application from a thread 
which is NOT the main thread.

I do not intend to create multiple QApplications, but wanted to know, 
what is so special about the main thread and why PyQt tells me, that I 
should create my GUI in the main thread.

I've read some vague information about some OS'es not allowing to show 
GUI elements in any other thread than the main thread.

The application in question is ONLY targeted for windows and for Linux.


>
> You can use the "qApp" variable which is from PyQt5.QtCore to refer to
> this singleton from other places.

I did not know this. Might be useful another time :-)
>
>
>
> On Sat, Jul 26, 2014 at 5:09 AM, Gelonida N <gelonida at gmail.com
> <mailto:gelonida at gmail.com>> wrote:
>
>     Hi,
>
>     I wanted to better understand the exact impact of this warning and
>     whether this warning has any impact if my code has to run on windows
>     /Linux only.
>
>     thanks in advance for any enlightment.
>
>
>
>
>
>     _________________________________________________
>     PyQt mailing list PyQt at riverbankcomputing.com
>     <mailto:PyQt at riverbankcomputing.com>
>     http://www.riverbankcomputing.__com/mailman/listinfo/pyqt
>     <http://www.riverbankcomputing.com/mailman/listinfo/pyqt>
>
>
>
>
> _______________________________________________
> PyQt mailing list    PyQt at riverbankcomputing.com
> http://www.riverbankcomputing.com/mailman/listinfo/pyqt
>




More information about the PyQt mailing list