title: wxPython - How to set an editor for a column of a grid
body: <p>The <a href="https://wxpython.org/Phoenix/docs/html/wx.grid.GridCellEditor.html#wx-grid-gridcelleditor" rel="nofollow noreferrer">docs</a> for <code>wx.grid.GridCellEditor</code> say </p>
  
  <blockquote>
    <p>Instances of <code>wx.grid.GridCellEditor</code> ... can be associated with the cell attributes for individual cells, rows, columns, or even for the entire grid.</p>
  </blockquote>
  
  <p>Now, I know how to associate an editor with a cell:</p>
  
  <pre><code>self.mygrid.SetCellEditor(row, 1, wx.grid.GridCellEditorSubclass())
  </code></pre>
  
  <p>And I know how to associate an editor with an entire grid:</p>
  
  <pre><code>self.mygrid.SetDefaultEditor(wx.grid.GridCellEditorSubclass())
  </code></pre>
  
  <p>But I don't know how to set an editor for a single column. This obvious workaround is not a good solution:</p>
  
  <pre><code>for row in range(nrows):
      self.mygrid.SetCellEditor(row, 1, wx.grid.GridCellEditorSubclass())
  </code></pre>
  
  <p>because if I add rows to the grid (which is a common operation), the new rows don't have the editor until I specifically set it again. </p>
  
  <p>The other obvious workaround is to associate a generic editor class with the entire grid and instantiate a column-specific editor at runtime based on the column number. </p>
  
  <p>The documentation  clearly implies that I shouldn't have to resort to either workaround. But it also doesn't offer (at least anywhere I can find) another way to do it.</p>
  
  <p>So, the question is, how do I set an editor for an entire grid column?</p>