2

When a wx.grid.Grid's column is resized, a wx.grid.GridSizeEvent is emitted. From the docs and dir(event) output this appears to be the most useless class in all of wxPython. It apparently doesn't tell you any of the relevant information regarding a column resize: which column was resized, what size it had before and which size it has now.

I suppose I can maintain a dict of {<column_index>: <column_size>} pairs, then manually derive the relevant data from that on each resize event, but I assume I've missed something and that this won't be necessary, so:

Is it possible to find out which column was resized from a GridSizeEvent without manually keeping track of all column sizes?

Hubro
  • 56,214
  • 69
  • 228
  • 381

1 Answers1

0

This class does have GetRowOrCol() accessor. As for the new size, I think you need to use GetPosition() - actual-width-or-height but I'm not 100% sure about this.

VZ.
  • 21,740
  • 3
  • 39
  • 42
  • `GetRowOrCol()` just returns 0 if a row was resized and 1 if a column was resized, which is entirely unhelpful since I'm listening to `EVT_GRID_COL_SIZE`. `GetPosition()` just returns the position of the cursor at the time of the event, so I'm afraid I don't entirely understand what you mean by `GetPosition() - actual-width-or-height`. – Hubro Feb 05 '13 at 18:43
  • Did you actually test that it always returned 0 or 1 or do you just suppose that it does? Because it's definitely supposed to return the index of the row or column being resized. – VZ. Feb 05 '13 at 19:42
  • I'm assuming, because when I debugged the event handler after resizing column #7, `event.GetPosition()` returned 1. I will definitively give it another shot though, just to make sure. – Hubro Feb 05 '13 at 23:17