[PyQt] Fwd: creating QWidgets outside the GUI thread

Erik Janssens Erik.Janssens at conceptive.be
Fri Dec 17 12:37:05 GMT 2010


well, the idea is not to initiate GUI changes from another
thread.

the idea is to do the construction of widgets outside the
GUI thread.  The reasons for this are :

- I have some screens that take considerable amount of time
  to build up 2 to 3 seconds (widgets only, not populating
  the widgets with data) -> during this time the GUI thread
  blocks.  (I found that using processEvents during the
  construction can lead to strange behavior)

- It could be used to pre-create all forms of an application
  in a worker thread and then move them to the GUI thread
  when the user requests them, resulting in super fast
  response times without affecting the startup time

On Fri, 2010-12-17 at 13:04 +0100, KONTRA, Gergely wrote:
> ---------- Forwarded message ----------
> From: KONTRA, Gergely <pihentagy at gmail.com>
> Date: Fri, Dec 17, 2010 at 13:03
> Subject: Re: [PyQt] creating QWidgets outside the GUI thread
> To: erik.janssens at conceptive.be
> 
> 
> AFAIK you shouldn't create or manipulate QWidgets just from the main
> thread. If you'd like to initiate some GUI change from a worker
> thread, you should use the signals & slots mechanism to delegate
> widget creation to the main thread.
> +-[ Gergely Kontra <pihentagy at gmail.com> ]------------------+
> |                                                           |
> | Mobile:(+36 20)356 9656                                   |
> |                                                           |
> +- "Olyan lángész vagyok, hogy poroltóval kellene járnom!" -+
> 
> 
> 
> On Fri, Dec 17, 2010 at 10:29, Erik Janssens
> <Erik.Janssens at conceptive.be> wrote:
> > Hi,
> >
> > has anybody experience with creating QWidgets outside the GUI
> > thread ?
> >
> > I'd like to know if it's possible to construct QWidgets in some kind
> > of worker thread, and when they are needed, reparent them and
> > move them to the GUI thread before displaying them.
> >
> > Regards,
> >
> > Erik
> > _______________________________________________
> > PyQt mailing list    PyQt at riverbankcomputing.com
> > 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