Пример #1
0
    def figureOutHeight(self, _width=100, content=""):
        temp_label = Label(width=_width, markup=True, text=content)
        d = temp_label._font_properties
        dkw = dict(zip(d, [getattr(temp_label, x) for x in d]))
        from kivy.core.text.markup import MarkupLabel
        la = MarkupLabel(**dkw)

        w, h = la.render(real=False) # makes the _lines variables

        # Grab the heights dimensions of the input (guard against empty string)
        input_heights = []
        for entry in la._lines:
            heights = [item[1] for item in entry[4]]
            input_heights.extend(heights)
        input_height = max(input_heights) if len(input_heights) > 0 else 0

        return input_height*len(la._lines)