Widget alignment inside a boxlayout

0

Good morning. I'm making a login screen using boxlayout like the image below:

How do I get Labels and InputText closer and center them?

The code is below:

<Login>:
canvas.before:
    Color:
        rgba: (0.5, 0.5, 0.5, 1)
    Rectangle:
        pos: self.pos
        size: self.size
orientation: 'vertical'
padding: 150
#spacing: 10

Image:
    source: 'Logo.jpg'
BoxLayout:
    orientation: 'horizontal'
    Label:
        text: 'Empresa:'
    TextInput:
        size_hint: .5,.45
        multiline: 'False'

BoxLayout:
    orientation: 'horizontal'
    Label:
        text: 'Login:'
    TextInput:
        size_hint: .5,.45
        multiline: 'False'

BoxLayout:
    orientation: 'horizontal'
    pos_hint: {'top': 1}

    Label:
        text: 'Senha:'
    TextInput:
        size_hint: .5,.45
        multiline: 'False'

I got the expected result using FloatLayout by setting the widget's X and Y position but this is unproductive as you know.

Thanks for your attention.

    
asked by anonymous 29.06.2018 / 14:19

1 answer

0

A very easy way, you just put the same size_hint in all elements, for example:

BoxLayout:
    orientation: 'horizontal'
    Label:
        text: 'Login:'
        size_hint: .5,.45 #size hint texto
    TextInput:
        size_hint: .5,.45 #size hint input
        multiline: 'False'

Do everything that will work:)

    
12.07.2018 / 16:27