On Mon, Mar 12, 2012 at 2:06 PM, Paul McNett <[email protected]> wrote:

> On 3/12/12 9:19 AM, STyler wrote:
> > Hi all, after finding out a bit I decided to use multiprocessing in Dabo
> > (no threads, problem GIL), what I want is to launch one or more jobs in
> > the background and the main program interface does not freeze, but show
> > me progress in a grid of each of these tasks. Anyone have any experience
> > or small example of how processes synchronize with the UI.
> >
> > Thank you very much for the help.
>
> I believe if you want true multiprocessing with wxPython you need to do it
> yourself,
> with n python interpreters messaging each other.
>
> But if you want your main program (with a wxPython App) to launch some
> subprocesses
> to do crunching, and those processes don't need a UI, then you can do that
> with the
> subprocess module.
>
> Sorry I have no examples, but if you figure out the specifics please post
> what you
> did here so others can do it, too.
>

The way I have done it for several items is to create a status class that
has properties for all of the information that you wish to update the UI
display with.  Then, for each of your processes, using Python's threading
library to run the sub-process as a separate thread.  The threads should
process and update the status class and CANNOT contain any wx calls or dabo
UI calls.

To update the UI, when you start the process, create your threads and then
use dabo's callAfterInterval method to call a UI update method.  That
method will update the UI and use callAfterInteveral to call itself again
until the job is done. It will update the UI by pulling the information
from the status object.

If you want the ability to cancel or the signaling of process complete, put
some boolean flags in the status object that your Threads and ui update
method can check.

Hope this helps.

Regards,

Nate


--- StripMime Report -- processed MIME parts ---
multipart/alternative
  text/plain (text body -- kept)
  text/html
---
_______________________________________________
Post Messages to: [email protected]
Subscription Maintenance: http://leafe.com/mailman/listinfo/dabo-users
Searchable Archives: http://leafe.com/archives/search/dabo-users
This message: 
http://leafe.com/archives/byMID/cal-abawbnjl2zubv2by3u+daffxtn25jja9bxuk4gj7_yrn...@mail.gmail.com

Reply via email to