Robin Dunn wrote:
Haim Ashkenazi wrote:
[...]def upload(self):
self.process = wxProcess(self)
self.process.Redirect()
cmd = 'python c:\\range.py'
pid = wxExecute(cmd, wxEXEC_ASYNC, self.process)while 1:
if self.process is None:
break
else:
stream = self.process.GetInputStream()
if stream.CanRead():
text = stream.read()
self.main_frame.download_text.AppendText(text)----------------------
I've also added to the wxApp 'OnInit' function the event:
EVT_END_PROCESS(self, -1, self.onProcessEnded)
which reads the last output and make self.process equal None.my problem is that it never gets to the 'onProcessEnded' function. it
loops forever inside the 'while' loop. I need this loop because the final
goal is to display a progress bar.I've found 'wxProcess.Exists' in the documentation but I coudn't figure
out how to use it. I've tried to run:
if wxProcess.Exists(pid)...
inside the loop but I got an error that class wxProcess doesn't have
'Exists' attribute...In 2.4 that function is accessed as wxProcess_Exists (since it is a
static C++ method). In 2.5 it will also be available as
wxProcess.Exists as expected.I'm sure I'm doing something very wrong here, but I just can't find out
what...The problem is your "while 1" loop. You must allow control to return to
the main loop in order to get any more events. Move the contents of
that loop to a timer or idle handler like is done in the demo.
thanx, I'll try it.
Bye
···
--
Haim