How to bring subprocess to the foreground?

Paul Boddie paul at boddie.org.uk
Sat Sep 6 19:53:58 CEST 2008


On 6 Sep, 17:58, dudeja.ra... at gmail.com wrote:
>
> I though of displayin an information message on the screen through
> tkMessageBox while the subprocess is running, I did it using:
>
> try:
>             testing = subprocess.Popen([batchFilePath], \
>                                    shell = True)
>
>             retCode = testing.wait()

Note that you wait for the process to finish here...

>             tkMessageBox._show("Test Harness execution", \
>                                icon = 'info', \
>                                message="Testing %s in progress..." % libName)

...and that you show a message about the process running *after*
waiting until it isn't running any more.

>         except:
>             tkMessageBox._show("Error", \
>                                type='ok', icon='error', \
>                                message="Error executing %s Test
> Harness" % libName)
>             return None
>         else:
>                 print retCode
>
> But the message is never displayed. Please suggest if there is
> something wrong with this code

I think you should first show your message, *then* wait for the
process to finish.

Paul



More information about the Python-list mailing list