We are using a wxPython wizard to lead users through setting up their execution environment for our application. A series of pages gathers required information leading up to a page that gives a summary of what the set up will look like. The next step is a fairly long running task and I would like to use a text control on the next wizard page to show progress and report errors. The task is started in the WIZARD_PAGE_CHANGED event handler when the user clicks next from the summary page.
The problem is that the wizard page to show status is not displayed until after the long running task completes. Can I force the page to display? and have print statements display in a text control on that page as they are issued?
Attached is a program that illustrates the problem. In this case, when the second wizard page is entered, I start a long running task (3 seconds), and you will see that the page does not display until the loop is complete. I want the page to display, and the status messages to appear as they occur.
Do I have to run my task on a separate thread and send status back to the GUI thread? Or is there some simpler approach. I have tried to Yield() at various points, but that seems to have no effect.
We are using a wxPython wizard to lead users through setting up their execution environment for our application. A series of pages gathers required information leading up to a page that gives a summary of what the set up will look like. The next step is a fairly long running task and I would like to use a text control on the next wizard page to show progress and report errors. The task is started in the WIZARD_PAGE_CHANGED event handler when the user clicks next from the summary page.
The problem is that the wizard page to show status is not displayed until after the long running task completes. Can I force the page to display? and have print statements display in a text control on that page as they are issued?
Attached is a program that illustrates the problem. In this case, when the second wizard page is entered, I start a long running task (3 seconds), and you will see that the page does not display until the loop is complete. I want the page to display, and the status messages to appear as they occur.
Do I have to run my task on a separate thread and send status back to the GUI thread? Or is there some simpler approach. I have tried to Yield() at various points, but that seems to have no effect.
Using wx.Yield() after the print statement in my loop has no effect.
Question: when does the Wizard class actually display the next page; before or after the event handler for EVT_WIZARD_PAGE_CHANGED completes? The internals probably are saying that we are now pointing to the next page, but it might not be visible yet.
If the answer is before, I don’t understand why wx.Yield() doesn’t work. If after, it seems to make sense because when I yield, there is still nothing there that could be visible.
In any case, I’m going to try using a separate thread and see if that works.
···
–
Mike Conley
On Tue, Apr 21, 2009 at 10:38 PM, Robin Dunn robin@alldunn.com wrote:
Mike Conley wrote:
We are using a wxPython wizard to lead users through setting up their execution environment for our application. A series of pages gathers required information leading up to a page that gives a summary of what the set up will look like. The next step is a fairly long running task and I would like to use a text control on the next wizard page to show progress and report errors. The task is started in the WIZARD_PAGE_CHANGED event handler when the user clicks next from the summary page.
The problem is that the wizard page to show status is not displayed until after the long running task completes. Can I force the page to display? and have print statements display in a text control on that page as they are issued?
Attached is a program that illustrates the problem. In this case, when the second wizard page is entered, I start a long running task (3 seconds), and you will see that the page does not display until the loop is complete. I want the page to display, and the status messages to appear as they occur.
Do I have to run my task on a separate thread and send status back to the GUI thread? Or is there some simpler approach. I have tried to Yield() at various points, but that seems to have no effect.
Using wx.Yield() after the print statement in my loop has no effect.
Question: when does the Wizard class actually display the next page; before or after the event handler for EVT_WIZARD_PAGE_CHANGED completes? The internals probably are saying that we are now pointing to the next page, but it might not be visible yet.
If the answer is before, I don't understand why wx.Yield() doesn't work. If after, it seems to make sense because when I yield, there is still nothing there that could be visible.
Confirmed, starting a thread to handle the task works as expected.
···
–
Mike Conley
On Wed, Apr 22, 2009 at 10:21 PM, Robin Dunn robin@alldunn.com wrote:
Mike Conley wrote:
Using wx.Yield() after the print statement in my loop has no effect.
Question: when does the Wizard class actually display the next page; before or after the event handler for EVT_WIZARD_PAGE_CHANGED completes? The internals probably are saying that we are now pointing to the next page, but it might not be visible yet.
If the answer is before, I don’t understand why wx.Yield() doesn’t work. If after, it seems to make sense because when I yield, there is still nothing there that could be visible.