| 1 | from wxPython.wx import * |
| 2 | import sys, time |
| 3 | |
| 4 | class WaitingProcess(wxProcess): |
| 5 | def __init__(self): |
| 6 | wxProcess.__init__(self, None) |
| 7 | self.terminated = false |
| 8 | def OnTerminate(self, pid, status): |
| 9 | print pid, status |
| 10 | self.terminated = true |
| 11 | def wait(self): |
| 12 | while not self.terminated: |
| 13 | stream = self.GetInputStream() |
| 14 | if not stream.eof(): |
| 15 | sys.stdout.write(stream.read()) |
| 16 | stream = self.GetErrorStream() |
| 17 | if not stream.eof(): |
| 18 | sys.stderr.write(stream.read()) |
| 19 | wxYield() |
| 20 | |
| 21 | try: |
| 22 | #raw_input("ready...") |
| 23 | if 1: |
| 24 | process = WaitingProcess() |
| 25 | process.Redirect() |
| 26 | pid = wxExecute('python -u wxFrame1.py', false, process) |
| 27 | process.wait() |
| 28 | else: |
| 29 | wxExecute('python -u wxFrame1.py') |
| 30 | |
| 31 | finally: |
| 32 | #raw_input("done...") |
| 33 | pass |
| 34 | |
| 35 | |
| 36 | |