Skip to content Skip to sidebar Skip to footer

Object Order In Stacklayout (kivy)

I have a layout = StackLayout() now I put buttons like this for x in range(9): # range() explanation: http://pythoncentral.io/pythons-range-function-explained/ bt = B

Solution 1:

Kivy reverses the order here for reasons to do with internal dispatching order. It doesn't have to, but it's a design decision.

However, this really doesn't matter at all. If you want to store your objects in some particular structure, do that yourself.

Solution 2:

a possible trick would be:

y = 10for x inrange(y):
        bt = Button(text=' ', font_size=200, width=200, height=200, size_hint=(None, None), id=str(y-x))
        bt.bind(on_release=self.btn_pressed)
        layout.add_widget(bt)

Post a Comment for "Object Order In Stacklayout (kivy)"