parameters: (self)
return_statement: return best
docstring: Calculate the best size of the button
          
          :return: :class:`Size`
docstring_summary: Calculate the best size of the button
          
          :return: :class:`Size`
docstring_tokens: Calculate the best size of the button : return : : class : Size
function: def DoGetBestSize(self):
          """Calculate the best size of the button
          
          :return: :class:`Size`
  
          """
          width = 4
          height = 6
          if self.Label:
              # NOTE: Should measure with a GraphicsContext to get right
              #       size, but due to random segfaults on linux special
              #       handling is done in the drawing instead...
              lsize = self.GetFullTextExtent(self.Label)
              width += lsize[0]
              height += lsize[1]
              
          if self._bmp['enable'] is not None:
              bsize = self._bmp['enable'].Size
              width += (bsize[0] + 10)
              if height <= bsize[1]:
                  height = bsize[1] + 6
              else:
                  height += 3
          else:
              width += 10
  
          if self._menu is not None or self._style & PB_STYLE_DROPARROW:
              width += 12
  
          best = wx.Size(width, height)
          self.CacheBestSize(best)
          return best
function_tokens: def DoGetBestSize ( self ) : width = 4 height = 6 if self . Label : # NOTE: Should measure with a GraphicsContext to get right #       size, but due to random segfaults on linux special #       handling is done in the drawing instead... lsize = self . GetFullTextExtent ( self . Label ) width += lsize [ 0 ] height += lsize [ 1 ] if self . _bmp [ 'enable' ] is not None : bsize = self . _bmp [ 'enable' ] . Size width += ( bsize [ 0 ] + 10 ) if height <= bsize [ 1 ] : height = bsize [ 1 ] + 6 else : height += 3 else : width += 10 if self . _menu is not None or self . _style & PB_STYLE_DROPARROW : width += 12 best = wx . Size ( width , height ) self . CacheBestSize ( best ) return best