0

I am trying to understand how StackLayout works within ScrollView in Kivy. And i have got a problem. I do not know how to insert a widget to the beginning of the layout. If i use .add_widget() method, it adds the widget to the end(in the bottom) of the layout. And if i change the orientation of the layout(it has stacking id) to 'lr-bt' and then add the widget(with "Title" and "Print" labels), then it causes some padding from the top of the ScrollView. So here is what i get:

padding from the top

May we could use other layouts. If anyone could help me fix that top padding or insert widget to the beginning, that would be great. Thanks.

Here is some code from .py file:

pln = Plan(text_label="Title", text="Print")
self.root.ids.stacking.add_widget(pln)

And here is my ScrollView with the StackLayout from .kv file:

            BoxLayout:
                id: stack_box
                size_hint_y: 1
                pos: 2, root.height-1057
                RecycleView:
                    scroll_y: 1
                    do_scroll_x: False
                    do_scroll_y: True
                    size_hint: 1, None
                    height: 1000
                    id: scroll_plans
                    StackLayout:
                        spacing: 10
                        padding: 10
                        id: stacking
                        orientation: 'lr-bt'
                        size_hint_y: None
                        height: 9000

0 Answers0