I understand there are lots of settings for setting layouts. Here is a ListCtrl of fixed dimensions inside a horizontal sizer.

This absolute size either displays leftover space or is too small depending on number of columns.
What are the layout commands to draw a ListCtrl?
How do I make the ListCtrl more responsive, so that it:
- shows data from many columns at a glance without needing a resize
- doesnt become bad on different GUIs and resizes
Code listing for the panel that hosts the list:
class CalcPanel(wx.Panel):
def __init__(self, parent):
wx.Panel.__init__(self, parent)
self.lc = wx.ListCtrl(self, -1, size=(200,200), style=wx.LC_REPORT)
self.lc.InsertColumn(0, 'State')
self.lc.InsertColumn(1, 'Capital')
#self.lc.SetColumnWidth(0, 140)
#self.lc.SetColumnWidth(1, 153)
#self.list_ctrl.Show()
self.sizer = wx.BoxSizer(wx.HORIZONTAL)
btn = wx.Button(self, label="Add Line")
self.sizer.Add(btn)
self.sizer.Add(self.lc, 1, wx.LEFT | wx.TOP | wx.GROW)
self.SetSizer(self.sizer)
self.Fit()
def InitUI(self):
pass
Have you looked at
wx.lib.mixins.listctrl.ListCtrlAutoWidthMixin?if you inherit from
wx.lib.mixins.listctrl.ListCtrlAutoWidthMixinas well aswx.ListCtrl, and call the classes__init__in your__init__method the last column will auto resize with resize eventsYou can also change which column auto resizes with
setResizeColumn