Search Results

Search found 1 results on 1 pages for 'elbenfreund'.

Page 1/1 | 1 

  • sizer.replace() paints "over" old sizercontent

    - by elbenfreund
    hi. I am rather new to wx/python so please excuse if this is stupid or ill described. I am substituting a nested sizer with a new one as shown in the snippet below. after some tinkering everything seems to work out but the re-drawing of the parent-sizer. the content of the old nested sizer remains and gets "painted" over with the new sizer content despite my sizer.Layout() system setup: - python 2.5.5.2 and 2.6.4 - wxpython 2.8 -- coding: utf8 -- import wx class Frame(wx.Frame): def init(self): wx.Frame.init(self, None, wx.ID_ANY, title='test') class Test(wx.App): def OnInit(self): frame = Frame() self.panel = wx.Panel(frame) self.panel.SetBackgroundColour('red') self.sizer = wx.BoxSizer(wx.VERTICAL) button = wx.Button(self.panel, wx.ID_ANY, 'TEST') self.hsizer = wx.BoxSizer(wx.HORIZONTAL) self.hsizer.Add(wx.StaticText(self.panel, wx.ID_ANY, 'nacknack')) self.sizer.Add(button) self.Bind(wx.EVT_BUTTON, self.on_test_button, button) self.text = wx.StaticText(self.panel, wx.ID_ANY, 'FOOO') self.sizer.Add(self.text) self.sizer.Add(self.hsizer) self.panel.SetSizer(self.sizer) frame.Show() return True def on_test_button(self, evt): tmpsizer = wx.BoxSizer(wx.VERTICAL) tmpsizer.Add(self.makesizer()) tmpitem = tmpsizer.GetChildren()[0] self.sizer.Replace(2, tmpitem) self.sizer.Layout() def makesizer(self): testsizer = wx.BoxSizer(wx.HORIZONTAL) testsizer.Add(wx.StaticText(self.panel, wx.ID_ANY, 'testsizer')) return testsizer if __name__ == '__main__': app = Test() app.MainLoop()

    Read the article

1