Hi All
A newbie question
I am executing a time consuming command with getstatusoutput & need to display a warning box for the user. The warning box does'nt display until _after_ the getstatusoutput command has completed.
Simplified section of code follows......
win = wx.MiniFrame(self, 99, "Listing backup - Please wait.....")
win.Show(True)
print 'listing now'
(status,output) = commands.getstatusoutput('afio -t -Z '+self.path)
win.Destroy()
self.result.WriteText(output)
I am sure there is a simple explanation, but I can't see it.
Any help would be appeciated.
···
--
Peter Bunney
peter bunney wrote:
Hi All
A newbie question
I am executing a time consuming command with getstatusoutput & need to
display a warning box for the user. The warning box does'nt display
until _after_ the getstatusoutput command has completed.
Simplified section of code follows......
win = wx.MiniFrame(self, 99, "Listing backup - Please wait.....")
win.Show(True)
print 'listing now'
(status,output) = commands.getstatusoutput('afio -t -Z '+self.path)
win.Destroy()
self.result.WriteText(output)
Try to call wx.Yield() right after Show()
Christian
Hi Peter. I posted earlier today querying folks to see if anyone had written a generic process manager since I am in the midst of gathering ideas before writing something for my myself.
It is my feeling that controlling a process this way is a much better approach (since your users could end up spinning their wheels waiting for something that may or may not have happened by sending an arbitrary command). Without events management as well, your app has no clue about what is really happening either so it can give you feedback which is handy.
wxPython has a wx.Execute which sets off the process asynchronously and can report back its pid. With some events handling and capturing the processes output, you can provide error reporting, query the processes to see if it is running, pop errors into a dialog etc if they occur, etc. This provides control and information over a process. I think this is a better way to skin the cat.
Regards,
David
peter bunney wrote:
···
Hi All
A newbie question
I am executing a time consuming command with getstatusoutput & need to display a warning box for the user. The warning box does'nt display until _after_ the getstatusoutput command has completed.
Simplified section of code follows......
win = wx.MiniFrame(self, 99, "Listing backup - Please wait.....")
win.Show(True)
print 'listing now'
(status,output) = commands.getstatusoutput('afio -t -Z '+self.path)
win.Destroy()
self.result.WriteText(output)
I am sure there is a simple explanation, but I can't see it.
Any help would be appeciated.