0

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)

1 Answer 1

1

Sounds like under some condition you want to skip a page. Look at the wxPython demo 'Run Dynamic Wizard' how this can be done.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.