Instead of threading you might use processing, difference is that
processing opens a new interpreter, that allows you to use different
processors at the same time and things don't collide. You may use dabo
and wxpython on all your processes.
Never used it in anger but it might be a better choice. This is a
translation of an article in spanish from PET #1 (Python Entre Todos)
magazine http://revista.python.org.ar

----------------------------------------------------------------------------------------------------
# -*- coding: utf-8 -*-
import processing
import time

def worker():
    print "Start working"
    time.sleep(2)
    print "Work is finished"

def main():
    print "Main process begins"
    myProc = processing.Process(target=worker)
    print "Start the process"
    myProc.start()
    print "The process is launched"

    # isAlive() returns false when the process ends.
    while myProc.isAlive():
        # Here goes the code that makes the main program look alive
        # a progress bar, or just keep working normally.
        print "The process is still running"
        # Wait a while, or at least till the process ends,
        # whatever happens first.
        myProc.join(.3)
    print "Program ends"

if __name__ == '__main__':
    main()
-----------------------------------------------------------------------------------------------------
Output :
-----------
$ python demo_processing_1.py
Main process begins
Start the process
The process is launched
El hilo sigue corriendo
Start working
The process is still running
The process is still running
The process is still running
The process is still running
The process is still running
The process is still running
Work is finished
Program ends
_______________________________________________
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/4f5e9308.5070...@gmail.com

Reply via email to