On 10/11/11 10:28 AM, Adam wrote:
> Also, a little off topic, but the intended purpose of the Run/Pause
> button is to start or stop an ongoing process (the blocks in the bitmap
> should move around and interact according to some rules, etc.). I am
> wondering now how to achieve this, since if I put it in its own loop I
> think this will arrest the main loop and render the controls inactive
> until the inner loop stops (which should only be when the button is
> pushed). Do I need to look into threading, or is there a way to merge
> this into the main loop so the controls will still work?

Interaction with the UI needs to happen in the main thread. The general 
approach to 
your problem goes sort of like:

progress = setUpProgressVisualizer():
for step in veryLongProcess():
   progress.iterate()
   dabo.ui.yieldUI()
   # ... do a step of the very long process here ...

This keeps everything in the main thread, but lets your progress display update 
at 
regular intervals.

Paul
_______________________________________________
Post Messages to: Dabo-users@leafe.com
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/4e948077.10...@ulmcnett.com

Reply via email to