Reputation: 226
New Python(Windows) user here...
I am working with the wx.wizard components and have ran into a bit of a roadblock.
Typically the RunWizard property gets ran and everything is controlled by the event handler.
Rather than having the user manually click the next button, I had a scenario where I wanted to click it for them.
I've spend hours trying to figure this out and here is my best attempt at it so far.
Essentially what I need to do is invoke the wx.EVT_BUTTON event on this button... but I haven't been able to make it work.
Any help would be greatly appreciated.
def on_page_changed(self, evt):
'''Executed after the page has changed.'''
if evt.GetDirection(): dir = "forward"
else: dir = "backward"
page = evt.GetPage()
print "page_changed: %s, %s\n" % (dir, page.__class__)
nextbutton = mywiz.FindWindowById(wx.ID_FORWARD)
button_event = wx.PyCommandEvent(wx.EVT_BUTTON.typeId, self.Id)
button_event.EventObject = self
wx.PostEvent(self, button_event)
if page is self.pages[0]:
nextbutton = mywiz.FindWindowById(wx.ID_FORWARD)
button_event = wx.PyCommandEvent(wx.EVT_BUTTON.typeId, self.Id)
button_event.EventObject = self
wx.PostEvent(self, button_event)
Upvotes: 0
Views: 166
Reputation: 2096
Sounds like under some condition you want to skip a page. Look at the wxPython demo 'Run Dynamic Wizard' how this can be done.
Upvotes: 1