parameters: (self, prop, value)
docstring: Sets a sizer property
      
      :param prop: valid strings are "proportion", "hgrow", "vgrow",
          "align", "halign", "valign", "border", "minsize" and "expand"
      :param value: corresponding value for the prop
docstring_summary: Sets a sizer property
      
      :param prop: valid strings are "proportion", "hgrow", "vgrow",
          "align", "halign", "valign", "border", "minsize" and "expand"
      :param value: corresponding value for the prop
docstring_tokens: Sets a sizer property : param prop : valid strings are proportion hgrow vgrow align halign valign border minsize and expand : param value : corresponding value for the prop
function: def SetSizerProp(self, prop, value):
      """
      Sets a sizer property
      
      :param prop: valid strings are "proportion", "hgrow", "vgrow",
          "align", "halign", "valign", "border", "minsize" and "expand"
      :param value: corresponding value for the prop
      """
      
      lprop = prop.lower()
      sizer = self.GetParent().GetSizer()
      item = sizer.GetItem(self) 
      flag = item.GetFlag()
      if lprop == "proportion":
          item.SetProportion(int(value))
      elif lprop == "hgrow":
          item.SetHGrow(int(value))
      elif lprop == "vgrow":
          item.SetVGrow(int(value))
      elif lprop == "align":
          flag = flag | align[value]
      elif lprop == "halign":
          flag = flag | halign[value]
      elif lprop == "valign":
          flag = flag | valign[value]
      # elif lprop == "border":
      #     # this arg takes a tuple (dir, pixels)
      #     dirs, amount = value
      #     if dirs == "all":
      #         dirs = ["all"]
      #     for dir in dirs:
      #         flag = flag | border[dir]
      #     item.SetBorder(amount)
      elif lprop == "border":
          # this arg takes a tuple (dir, pixels)
          dirs, amount = value
          if dirs == "all":
              dirs = ["all"]
          else:
              flag &= ~(wx.ALL)
          for dir in dirs:
              flag = flag | border[dir]
          item.SetBorder(amount)
      elif lprop == "minsize":
          flag = flag | minsize[value]
      elif lprop in misc_flags:
          if not value or str(value) == "" or str(value).lower() == "false":
              flag = flag &~ misc_flags[lprop]
          else:
              flag = flag | misc_flags[lprop]
      
      # 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" and not sizer.IsColGrowable(col):
              sizer.AddGrowableCol(col)
          elif lprop == "proportion" and int(value) != 0 and not sizer.IsRowGrowable(row):
              sizer.AddGrowableRow(row)
  
      item.SetFlag(flag)
function_tokens: def SetSizerProp ( self , prop , value ) : lprop = prop . lower ( ) sizer = self . GetParent ( ) . GetSizer ( ) item = sizer . GetItem ( self ) flag = item . GetFlag ( ) if lprop == "proportion" : item . SetProportion ( int ( value ) ) elif lprop == "hgrow" : item . SetHGrow ( int ( value ) ) elif lprop == "vgrow" : item . SetVGrow ( int ( value ) ) elif lprop == "align" : flag = flag | align [ value ] elif lprop == "halign" : flag = flag | halign [ value ] elif lprop == "valign" : flag = flag | valign [ value ] # elif lprop == "border": #     # this arg takes a tuple (dir, pixels) #     dirs, amount = value #     if dirs == "all": #         dirs = ["all"] #     for dir in dirs: #         flag = flag | border[dir] #     item.SetBorder(amount) elif lprop == "border" : # this arg takes a tuple (dir, pixels) dirs , amount = value if dirs == "all" : dirs = [ "all" ] else : flag &= ~ ( wx . ALL ) for dir in dirs : flag = flag | border [ dir ] item . SetBorder ( amount ) elif lprop == "minsize" : flag = flag | minsize [ value ] elif lprop in misc_flags : if not value or str ( value ) == "" or str ( value ) . lower ( ) == "false" : flag = flag & ~ misc_flags [ lprop ] else : flag = flag | misc_flags [ lprop ] # 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" and not sizer . IsColGrowable ( col ) : sizer . AddGrowableCol ( col ) elif lprop == "proportion" and int ( value ) != 0 and not sizer . IsRowGrowable ( row ) : sizer . AddGrowableRow ( row ) item . SetFlag ( flag )