title: Make column width take up available space in wxPython ListCtrl
body: <p>I have three columns in my <code>wx.ListCtrl(size=(-1,200))</code>. I would like the columns to fill up the width of the ListCtrl after its created. Ideally, the first column can expand to fill up the extra space available. The second and third columns don't need to expand, and preferably will not change in width (formatting ocd).</p>
  
  <p>Currently, each ListCtrl column is set up using <code>(width=-1)</code>.</p>
  
  <p>I have a feeling I can use this section of the code to my advantage...</p>
  
  <pre class="lang-python prettyprint-override"><code># Expand first column to fit longest entry item
  list_ctrl.SetColumnWidth(0, wx.LIST_AUTOSIZE)
  </code></pre>
  
  <p>Pseudo-code (perhaps):</p>
  
  <pre class="lang-none prettyprint-override"><code># After wx.ListCtrl creation
  Get width of ListCtrl control
  Get width of each ListCtrl column
  Calculate unused width of ListCtrl
  Set first column width to original width + unused width
  </code></pre>
  
  <h1>Added:</h1>
  
  <p>Given the following example, I don't understand how to initiate the autowidthmixin. Currently, I am trying to put the listctrl inside a foldpanel. The foldpanel is a class and a function within the class creates the listctrl. I am not even confident that this can be done given the structure of my code at the moment!</p>
  
  <pre class="lang-python prettyprint-override"><code>class MyPanel(wx.Panel):
  
      def __init__(self, parent, dictionary):
          self.dictionary = dictionary
          """Constructor"""
          wx.Panel.__init__(self, parent)
  
          # Layout helpers (sizers) and content creation (setPanel)
          self.mainSizer = wx.BoxSizer(wx.VERTICAL)
          self.SetSizer(self.mainSizer)
          list_ctrl = self.setPanel()
          self.mainSizer.Add(list_ctrl, 0, wx.ALL | wx.EXPAND, 5)
          self.GetSizer().SetSizeHints(self)
  
      def setPanel(self):
          index = 0
  
          list_ctrl = wx.ListCtrl(self, size=(-1, 200),
                                  style=wx.LC_REPORT | wx.BORDER_SUNKEN)
  
          list_ctrl.InsertColumn(0, "Variable", format=wx.LIST_FORMAT_LEFT, width=-1)
          list_ctrl.InsertColumn(1, "x", format=wx.LIST_FORMAT_RIGHT, width=-1)
          list_ctrl.InsertColumn(2, u"\u03D0", format=wx.LIST_FORMAT_RIGHT, width=-1)
  
          for key, value in self.dictionary.iteritems():
              list_ctrl.InsertStringItem(index, str(key))
              list_ctrl.SetStringItem(index, 1, ("%.2f" % value[0]))
              list_ctrl.SetStringItem(index, 2, ("%.8f" % value[1]))
              index += 1
  
          list_ctrl.SetColumnWidth(0, wx.LIST_AUTOSIZE)
          list_ctrl.SetColumnWidth(1, wx.LIST_AUTOSIZE)
          list_ctrl.SetColumnWidth(2, wx.LIST_AUTOSIZE)
  
          return list_ctrl
  </code></pre>