Search code examples
pythonwxpythonwxwidgets

wxPython's wx.ListCtrl in simple list mode (not style = wx.LC_REPORT)


I have a tutorial on how to use a wx.ListCtrl in (style = wx.LC_REPORT) mode but I only use one column:

self.InsertColumn(0, "Item")

How can I either:

  • stretch the column to take the whole avail. length
  • switch to a more basic mode using just one column to begin with?

I don't really need the field label I am using above (i.e. "Item").


Solution

  • Try using a wx.ListBox control instead of a wx.ListCtrl.

    The display mode of ListCtrl closest to what you're looking for is wx.LC_LIST, and in that mode the control will render multiple items side-by-side if it has enough horizontal extent.

    On the other hand, a simple ListBox does exactly what you're looking for.