Reputation: 3423
In wxPython, If I have a frame and in it I have a sizer with a ListCtrl object; what is the easiest way that I can switch this listctrl object to another one.
example-code
self.list = wx.ListCtrl(panel, size=(-1, 530), style=wx.LC_REPORT|wx.BORDER_SUNKEN|wx.LC_HRULES )
self.list.InsertColumn(0, 'Country' , width = 140)
self.list.InsertColumn(1, 'Consumption', width = 115)
sizer.Add(self.list, 0, wx.ALL|wx.EXPAND, 5)
Can I change this listctrl object in sizer to another one???
Upvotes: 0
Views: 64
Reputation: 868
I'm not quite sure what you are trying to do but I am going to take a guess at it and say that you have two ListCtrl's within your gui and you want to be able to switch between them?
If so, I guess my first suggestion would be to just reuse s single ListCtrl for both purposes, there really is no need to have two controls when you can simply refresh the columns/items within the one that is already in-place. If you MUST have both controls, you could just add both to the sizer and hide/show them as needed, or use the sizers Replace(oldWin, newWin) function.
More wxSizer information can be found here.
If this is not what you were referring to than I would suggest that you add bit more detail to your question as it is a bit vague. ;)
Upvotes: 1