Hello,
I have this code:
class SoundLog(wx.Frame):
def __init__(self, *args, **kwargs):
wx.Frame.__init__(self, size=(500, 350), *args, **kwargs)
self.SetBackgroundColour((110,110,110))
self.sizer = wx.BoxSizer(wx.VERTICAL)
pluginsNumber = len(plugins) - len(pluginsToHide)
self.gs = wx.GridSizer(pluginsNumber, 1, 0, 0)
pluginsList = self.getPluginsList()
self.gs.AddMany(pluginsList)
self.sizer.Add(self.gs, 1, wx.EXPAND)
self.SetSizer(self.sizer)
self.Centre()
self.Show(True)
How can I make a function that redefines the GridSizer defined here?
Is something like this:
def redefineSizer(self):
self.Show(False)
pluginsNumber = len(plugins) - len(pluginsToHide)
self.gs.Clear()
self.sizer.Remove(self.gs)
self.gs = wx.GridSizer(pluginsNumber, 1, 0, 0)
print self.gs
pluginsList = self.getPluginsList()
self.gs.AddMany(pluginsList)
self.sizer.Add(self.gs, 1, wx.EXPAND)
self.SetSizer(self.sizer)
self.Centre()
self.Show(True)
or something like this:
def redefineSizer(self):
pluginsNumber = len(plugins) - len(pluginsToHide)
self.gs.SetRows(pluginsNumber)
self.gs.Clear(deleteWindows=False)
pluginsList = self.getPluginsList()
self.gs.AddMany(pluginsList)
self.SetSizer(self.sizer)
But I know (cause it's not working) that I'm missing something. What it is?
I put panels inside the GridSizer, but with an option to close them. When I close one panel, I want to redefine the GridSizer to have one row less and to remove the closed panel.
So, when I click on close, I call redefineSizer to remove that panel and update itself. That's what I want to do!
Thanks in advance :)