Reputation:
I am new to kivy.
There is something about the orientation
property of the BoxLayout class which is confusing me: if i set the orientation to vertical the child widgets are actually set up horizontally and vice versa. What am i understanding wrong? Why is that decided to be so and not other way around which is more intuitive?
Here are my codes:
# main.py
from kivy.app import App
class LernApp(App):
pass
if __name__ == "__main__":
LernApp().run()
# lern.kv
BoxLayout
orientation: "vertical"
Button
text: "Button1"
Button
text: "Button2"
This produces this window:
Upvotes: 1
Views: 1558
Reputation: 93
I don't understand what you want exactly, but I think you want the buttons horizontally
try this :
from kivy.app import App
class LernApp(App):
# lern.kv
return BoxLayout("""
orientation: "horizontal"
Button:
text: "Button1"
Button:
text: "Button2"
"""
if __name__ == "__main__":
LernApp().run()
Or try this
from kivy.app import App
class LernApp(App):
# lern.kv
return BoxLayout("""
orientation: "horizontal"
Button:
text: "Button1"
Button:
text: "Button2"
"""
if __name__ == "__main__":
LernApp().run()
Upvotes: 0
Reputation: 8066
The widgets are stacked vertically. So the meaning of orientation is how to stack widgets inside the BoxLayout.
Upvotes: 4