+
+ # auto-adjust growable rows/columns if expand or proportion is set
+ # on a sizer item in a FlexGridSizer
+ if lprop in ["expand", "proportion"] and isinstance(sizer, wx.FlexGridSizer):
+ cols = sizer.GetCols()
+ rows = sizer.GetRows()
+ # FIXME: I'd like to get the item index in the sizer instead, but
+ # doing sizer.GetChildren.index(item) always gives an error
+ itemnum = self.GetParent().GetChildren().index(self)
+
+ col = 0
+ row = 0
+ if cols == 0:
+ col, row = divmod( itemnum, rows )
+ else:
+ row, col = divmod( itemnum, cols )
+
+ if lprop == "expand":
+ sizer.AddGrowableCol(col)
+ elif lprop == "proportion" and int(value) != 0:
+ sizer.AddGrowableRow(row)