tags:

views:

125

answers:

0

I'm sure this is simple, but I can't seem to find the answer. While using wx.MDIParentFrame, I open a new window with wx.MDIChildFrame. There is static text on the ParentFrame, and once the ChildFrame opens the text gets erased from the ParentFrame?

import wx

class Frame(wx.MDIParentFrame):
    def __init__(self):
        wx.MDIParentFrame.__init__(self, None, -1, "Main Window", size=(800,600), style=wx.DEFAULT_FRAME_STYLE | wx.FRAME_NO_WINDOW_MENU)
        menu = wx.Menu()
        menu.Append(100, "&New Window")
        menu.Append(101, "E&xit")
        menubar = wx.MenuBar()
        menubar.Append(menu, "&File")
        self.SetMenuBar(menubar)
        self.Bind(wx.EVT_MENU, self.OnNewWindow, id=100)
        self.Bind(wx.EVT_MENU, self.OnExit, id=101)
        self.Center()

        background_text = wx.StaticText(self, id=-1, label="This is background text", pos = (20, 250))

    def OnExit(self, evt):
        self.Close(True)
        self.Destroy()

    def OnNewWindow(self, evt):
        win = wx.MDIChildFrame(self, -1, "Child Window", size = (300, 300), style=wx.DEFAULT_FRAME_STYLE ^ (wx.MAXIMIZE_BOX | wx.RESIZE_BORDER))
        win.SetBackgroundColour("#BB00e0")
        win.Show(True)

if __name__ == '__main__':
    app = wx.PySimpleApp()
    frame = Frame()
    frame.Show()
    app.MainLoop()