Hello,
I am a but confused with this Kivy language -- which I approach just last week.
On the manuals, it looks pretty simple, a bit like in HTML: the screen is divided in rows and columns and one populates the different cells sequentially. So I wrote the following scripts, with the idea of creating a screen with two rows one column, the first cell containing a button stratching 80% of the screen in the y dimension and 100% in the x dimension, the second cell containing a label of 20% on y and 100% on x:
# myapp.py
import kivy
kivy.require('1.10.1')
from kivy.app import App
from kivy.uix.gridlayout import GridLayout
class myLayout(GridLayout):
pass
class MyApp(App):
def build(self):
return myLayout()
if __name__ == "__main__":
MyApp().run()
# myapp.kv
#:kivy 1.10.1
<myLayout@GridLayout>:
orientation: "vertical"
Button:
size_hint_x: 1
size_hint_y: 0.8
pos_hint: {'x': 0.5, 'top': 1}
text: "BUTTON HERE"
Label:
size_hint_x: 1
size_hint_y: 0.2
pos_hint: {'x': 0.5, 'top': 0}
text: "label here"
But the result is that both the button and the label are placed on the bottom left corner and are juxtaposed as in the attached figure.
What am I getting wrong?
Thank you