(self, *args, **kwargs)
Set the contents margins.
        Supports a single number or 4 numbers, with optional overrides of
        "top", "left", "right" and "bottom".
Set the contents margins.
        Supports a single number or 4 numbers, with optional overrides of
        "top", "left", "right" and "bottom".
Set the contents margins . Supports a single number or 4 numbers with optional overrides of top left right and bottom .
def setContentsMargins(self, *args, **kwargs):
        """Set the contents margins.
        Supports a single number or 4 numbers, with optional overrides of
        "top", "left", "right" and "bottom".
        """
        margins = [None, None, None, None]
        #Set the base number first
        if args:
            num_args = len(args)
            if num_args == 1:
                margins = [args[0], args[0], args[0], args[0]]
            elif num_args == 4:
                margins = args
            else:
                raise TypeError('expect 1 or 4 arguments, got {}'.format(num_args))

        #Handle overrides
        if kwargs:
            for i, keyword in enumerate(['left', 'top', 'right', 'bottom']):
                if kwargs.get(keyword) is not None:
                    margins[i] = kwargs[keyword]

        #Set any remaining values
        if sum([i is not None for i in margins]) != 4:
            margins = [i if i is not None else j for i, j in zip(margins, self.QObject.getContentsMargins())]
        self.QObject.setContentsMargins(*margins)
def setContentsMargins ( self , * args , * * kwargs ) : margins = [ None , None , None , None ] #Set the base number first if args : num_args = len ( args ) if num_args == 1 : margins = [ args [ 0 ] , args [ 0 ] , args [ 0 ] , args [ 0 ] ] elif num_args == 4 : margins = args else : raise TypeError ( 'expect 1 or 4 arguments, got {}' . format ( num_args ) ) #Handle overrides if kwargs : for i , keyword in enumerate ( [ 'left' , 'top' , 'right' , 'bottom' ] ) : if kwargs . get ( keyword ) is not None : margins [ i ] = kwargs [ keyword ] #Set any remaining values if sum ( [ i is not None for i in margins ] ) != 4 : margins = [ i if i is not None else j for i , j in zip ( margins , self . QObject . getContentsMargins ( ) ) ] self . QObject . setContentsMargins ( * margins )