Hi - I have tried and tried with this, googled and what knot, but to no avail.

I just need the frame to clear. The code below shows the overlay problem which I tried clearing with all types of panel.Clear() / self.panel.Clear() combos etc.

import wx

class MyFrame(wx.Frame):
    def __init__(self, parent, id, title):
        wx.Frame.__init__(self, parent, id, title, size=(400, 200))
        panel=wx.Panel(self)

        wx.StaticText(panel, -1, "Main Frame...", (10,10))
        menuBar = wx.MenuBar()
        menu1 = wx.Menu()
        menu1.Append(101, "Text 1", "Text1")
        menu1.AppendSeparator()
        menu1.Append(102, "Text 2", "Text2")
        menuBar.Append(menu1, "&File")
        self.SetMenuBar(menuBar)

        self.Bind(wx.EVT_MENU, self.ChangeText1, id=101)
        self.Bind(wx.EVT_MENU, self.ChangeText2, id=102)

    def ChangeText1(self, event):
        #self.panel.Clear()
        wx.StaticText(self, -1, "text1", (10,10))
    def ChangeText2(self, event):
        #self.panel.Clear()
        wx.StaticText(self, -1, "text2", (10,10))

class MyApp(wx.App):
    def OnInit(self):
        frame = MyFrame(None, -1, 'Main Frame')
        frame.Show(True)
        self.SetTopWindow(frame)
        return True

app = MyApp(0)
app.MainLoop()

Many thanks for any help - cheers.

Sorry I am a noob to python(previously a php'er) - How would I do that in the sample given. Many thanks

I don't think you want to create a new label widget every time you click on the menu item. That would eventually tax your computers memory. I corrected your code to replace the text in the same label ...

import wx

class MyFrame(wx.Frame):
    def __init__(self, parent, id, title):
        wx.Frame.__init__(self, parent, id, title, size=(400, 200))
        panel=wx.Panel(self)

        self.label = wx.StaticText(panel, -1, "Main Frame...", (10,10))
        menuBar = wx.MenuBar()
        menu1 = wx.Menu()
        menu1.Append(101, "Text 1", "Text1")
        menu1.AppendSeparator()
        menu1.Append(102, "Text 2", "Text2")
        menuBar.Append(menu1, "&File")
        self.SetMenuBar(menuBar)

        self.Bind(wx.EVT_MENU, self.ChangeText1, id=101)
        self.Bind(wx.EVT_MENU, self.ChangeText2, id=102)

    def ChangeText1(self, event):
        self.label.SetLabel("text1")

    def ChangeText2(self, event):
        self.label.SetLabel("text2")

class MyApp(wx.App):
    def OnInit(self):
        frame = MyFrame(None, -1, 'Main Frame')
        frame.Show(True)
        self.SetTopWindow(frame)
        return True

app = MyApp(0)
app.MainLoop()
This question has already been answered. Start a new discussion instead.