
from wxPython.wx import *

ID_FIRE_FIRST = 10001
ID_FIRE_SECOND = 10002

class myFrame(wxFrame):
    def __init__(self, parent):
        wxFrame.__init__(self, parent, -1, "Mainframe")
        button = wxButton(self, ID_FIRE_FIRST, "Start the mess")
        EVT_BUTTON(self, ID_FIRE_FIRST, self.OnFire)
        self.dia = firstDialog(self)

    def OnFire(self, event):
        self.dia.Centre()
        self.dia.ShowModal()
        
class secondDialog(wxDialog):
    def __init__(self, parent):
        wxDialog.__init__(self, parent, -1, "I am #2", style = wxDIALOG_MODAL | wxCAPTION | wxSTAY_ON_TOP)
        button = wxButton(self, wxID_CANCEL, "Close me")
        
class firstDialog(wxDialog):
    def __init__(self, parent):
        wxDialog.__init__(self, parent, -1, "I am #1", style = wxDIALOG_MODAL | wxCAPTION | wxSTAY_ON_TOP)
        button = wxButton(self, ID_FIRE_SECOND, "Fire second dialog")
        EVT_BUTTON(self, ID_FIRE_SECOND, self.OnFire)
        self.dia = secondDialog(self)
        
    def OnFire(self, event):
        self.dia.Centre()
        self.dia.ShowModal()
        self.Close()

if __name__ == "__main__":
    class TestApp(wxApp):
        def OnInit(self):
            frm = myFrame(NULL)
            frm.Centre()
            frm.Show()
            print "Result was: ", result
            return false

    app = TestApp(0)
    app.MainLoop()
    