python - How can I change the orientation of a buttons in a stack layout in Kivy -
from kivy.app import app kivy.uix.button import button kivy.uix.stacklayout import stacklayout class mylayout(stacklayout): def __init__(self, **kwargs): super(mylayout, self).__init__(**kwargs) in range(10): btn = button(text=str(i), width=40, size_hint=(none, 0.15), orientation= 'lr-bt') self.add_widget(btn) class nameapp(app): def build(self): ml = mylayout() return ml if __name__ == "__main__": nameapp().run()
i have attempted change orientation here, orientation displayed on app still if default
orientation property of layout, not of widgets contains. can use
self.orientation = "lr-bt"
in __init__
function assign property layout. assign in appropriate .kv file if use that.
Comments
Post a Comment