X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/2f90df854ed9630ab60ac7729287807e4d1d8286..6932a32c2b1072879a7be05dae5308f79fe4bd80:/utils/wxPython/lib/grids.py diff --git a/utils/wxPython/lib/grids.py b/utils/wxPython/lib/grids.py index d67443e07b..2b26ec9ece 100644 --- a/utils/wxPython/lib/grids.py +++ b/utils/wxPython/lib/grids.py @@ -1,5 +1,5 @@ #---------------------------------------------------------------------- -# Name: wxPython.lib.GridSizer +# Name: wxPython.lib.grids # Purpose: An example sizer derived from the C++ wxPySizer that # sizes items in a fixed or flexible grid. # @@ -12,13 +12,11 @@ #---------------------------------------------------------------------- """ - -In this module you will find wxGridSizer and wxFlexgridSizer. +In this module you will find wxGridSizer and wxFlexGridSizer. wxGridSizer arrainges its items in a grid in which all the widths and heights are the same. wxFlexgridSizer allows different widths and heights, and you can also specify rows and/or columns that are growable. See the demo for a couple examples for how to use them. - """ @@ -132,22 +130,18 @@ class wxGridSizer(wxPySizer): isz = item.CalcMin() flag = item.GetFlag() - if flag & wxEXPAND: + if flag & wxEXPAND or flag & wxSHAPED: isz = wxSize(w, h) + else: + if flag & wxALIGN_CENTER_HORIZONTAL: + ipt.x = x + (w - isz.width) / 2 + elif flag & wxALIGN_RIGHT: + ipt.x = x + (w - isz.width) - elif flag & wxCENTER: - ipt.x = x + (w - isz.width) / 2 - ipt.y = y + (h - isz.height) / 2 - - if flag & wxALIGN_LEFT: - ipt.x = x - elif flag & wxALIGN_RIGHT: - ipt.x = x + (w - isz.width) - - if flag & wxALIGN_TOP: - ipt.y = y - elif flag & wxALIGN_BOTTOM: - ipt.y = y + (h - isz.height) + if flag & wxALIGN_CENTER_VERTICAL: + ipt.y = y + (h - isz.height) / 2 + elif flag & wxALIGN_BOTTOM: + ipt.y = y + (h - isz.height) item.SetDimension(ipt, isz) @@ -230,6 +224,9 @@ class wxFlexGridSizer(wxGridSizer): for idx in self.growableCols: self.colWidths[idx] = self.colWidths[idx] + delta + # bottom right corner + sz = wxSize(pt.x + sz.width, pt.y + sz.height) + # Layout each cell x = pt.x for c in range(ncols):