views:

18

answers:

1

Hi,

I'm using a wxWizard control. I know about the on EVT_WIZARD_PAGE_CHANGED and the EVT_WIZARD_PAGE_CHANGING events but could anyone please tell me how to trigger an event when a particular wizard page loads?

Thanks.

A: 

from the Wxwizard.py example included with wx distribution

 def OnWizPageChanged(self, evt):
    if evt.GetDirection():
        dir = "forward"
    else:
        dir = "backward"

    page = evt.GetPage()
    self.log.write("OnWizPageChanged: %s, %s\n" % (dir, page.__class__))

This could be modified

 def OnWizPageChanged(self, evt):
    page = evt.GetPage()
    if (isinstance(page,MyParticularClass):
        # do something, generate event, whatever
        pass
iondiode
I tried something similar. I just didn't use the `isinstance` bit ans instead called a method in the page. (I made sure that each page had that method and wrote page specif code there) The problem I had was of the evening firing twice. Every time i switched the page, the event triggered twice for some reason. I could easily kludge and get around this but I thought that i must be doing something wrong. Have you encountered a similar problem?
Mridang Agarwalla
nope, i get 1 changing and 1 changed event every time i click. i am on wx.version: 2.8.10.1. Do you have and evt.Skip() in your callback? If you do, try removing it, because i think the event will be regenerated on button up
iondiode