Skip to content Skip to sidebar Skip to footer

Using A Rst Document In A Scrollview Using Kivy

I am in a bit of a predicament. While working with Kivy's ScrollView Layout and (Current Experimental) reStructuredText renderer module, I ran into a slight problem. Whenever I run

Solution 1:

Sometimes height: self.minimum_height and similar stuff are like shooting yourself in a foot. Definitely try to comment out these things first, because if you don't do something fancy, the sizing is the issue.

Now, why is it an issue? StackLayout has its minimum_height set from minimum_size, which is set I think somewhere here and has some initial value that is not zero.

Don't be confused though, minimum_height really defaults to zero at the beginning, but then it's recalculated probably on each added widget or so. If you add on_height: print(self.height) after your height: self.minimum_height, you'll see what I mean.

Why does it do it like that? Simple! You didn't set absolute size for those children (each child has size_hint == [1, 1]).

Also, ScrollView expects size bigger that the ScrollView if I remember correctly (so that it would scroll).

fromkivy.langimportBuilderfromkivy.baseimportrunTouchAppfromkivy.uix.boxlayoutimportBoxLayoutBuilder.load_string('''
<Test>:
    orientation: 'vertical'ScrollView:
        size_hint: (.99, .99)
        StackLayout:
            size_hint_y: None
            id: content_layout
            height: self.minimum_height
            on_height: print(self.height)
            Label:
                size_hint: None, None
                size: 100, 30text: "Test"font_size: min(root.height, root.width)
            RstDocument:
                size_hint: None, None
                size: 100, 1000underline_color: 'blue'text:("Some Text")
''')
classTest(BoxLayout): passrunTouchApp(Test())

Remove size_hint and size from children and you have your too much iteration there.

Post a Comment for "Using A Rst Document In A Scrollview Using Kivy"