Button position in kivy gridlayout
<p>I'm trying to move this button to top-right but no matters what I do I just can't move it. It is <strong>always</strong> in the bottom-left and never leaves this position.</p>

<p>This is my .py:</p>

<pre><code>    #!/usr/bin/python
    # coding=UTF-8

    import kivy
    from kivy.uix.gridlayout import GridLayout
    from kivy.app import App
    from kivy.uix.button import Button
    from kivy.lang import Builder

    Builder.load_file('listadex.kv')

    class TestS(GridLayout):
        def bt1(self):
            print 'Olar galera'        #layout.add_widget(bt1.Button(text='TestS'))

    class SegundaTela(App):
        def build(self):
    #layout = GridLayout(cols=2, row_force_default=False, row_default_height=10)
    #layout.add_widget(bt1.Button(text='TestS'))
    #layout.add_widget(bt2.Button(text='TestA'))
    #layout.add_widget(bt3.Button(text='TestD'))
    #layout.add_widget(bt4.Button(text='TestMC'))
    #return layout
    CF = TestS()
    return CF

    SegundaTela().run()
</code></pre>

<p>And this is my .kv</p>

<pre><code>    &lt;TestS&gt;:
        GridLayout:
            rows: 1
            cols: 1
            padding: 3
            spacing: 3

            Button:
                text: 'botao1'
                on_press: root.bt1()
                pos_hint: {'center_x':.15}
</code></pre>

<p>I suggest using relative layout. for example </p>

<pre><code>RelativeLayout:

    Button:
        text: 'botao1'
        on_press: root.bt1()
        pos_hint: {'center_x': 0.5, 'center_y': 0.5}
</code></pre>

<p>change <code>center_x</code> and <code>center_y</code> till they meet your needs.</p>

python python-2.7 kivy kivy-language