elsie/box.py
def line_box(self, index, lines=1, **kwargs):
        """ Create a box around a line of text.
            'self' has to contain a text """
        def compute_y():
            if not self._text_lines:
                raise Exception("line_box() called on box with no text")
            line_height = self._text_height / self._text_lines
            y = self._rect.y + (self._rect.height - self._text_height) / 2
            return y + line_height * index

        def compute_height():
            if not self._text_lines:
                raise Exception("line_box() called on box with no text")
            return lines * self._text_height / self._text_lines + 1

        kwargs.setdefault("width", "fill")
        kwargs.setdefault("x", 0)
        kwargs.setdefault("y", LazyValue(compute_y))
        kwargs.setdefault("height", LazyValue(compute_height))
        return self.box(**kwargs)
 Create a box around a line of text.
            'self' has to contain a text 
Create a box around a line of text.
'self' has to contain a text
Create a box around a line of text . ' self ' has to contain a text
def line_box(self, index, lines=1, **kwargs):
        def compute_y():
            if not self._text_lines:
                raise Exception("line_box() called on box with no text")
            line_height = self._text_height / self._text_lines
            y = self._rect.y + (self._rect.height - self._text_height) / 2
            return y + line_height * index
        def compute_height():
            if not self._text_lines:
                raise Exception("line_box() called on box with no text")
            return lines * self._text_height / self._text_lines + 1
        kwargs.setdefault("width", "fill")
        kwargs.setdefault("x", 0)
        kwargs.setdefault("y", LazyValue(compute_y))
        kwargs.setdefault("height", LazyValue(compute_height))
        return self.box(**kwargs)
def line_box ( self , index , lines = 1 , ** kwargs ) : def compute_y ( ) : if not self . _text_lines : raise Exception ( "line_box() called on box with no text" ) line_height = self . _text_height / self . _text_lines y = self . _rect . y + ( self . _rect . height - self . _text_height ) / 2 return y + line_height * index def compute_height ( ) : if not self . _text_lines : raise Exception ( "line_box() called on box with no text" ) return lines * self . _text_height / self . _text_lines + 1 kwargs . setdefault ( "width" , "fill" ) kwargs . setdefault ( "x" , 0 ) kwargs . setdefault ( "y" , LazyValue ( compute_y ) ) kwargs . setdefault ( "height" , LazyValue ( compute_height ) ) return self . box ( ** kwargs )
Create a box around a line of text.
Create a box around a line of text .
""" Create a box around a line of text.
            'self' has to contain a text """
self
index
lines