0

I'm having trouble trying to adjust my buttons positions. I want to add a padding-top thing but they don't move! I've tried a lot of things so any help is very welcome!

Also I don't know why I have to use 'cols: 2' so many times for them to be side by side...

I'm adding a photo of how it is:

this is how it looks like

this is my kv file:

GridLayout:
    cols: 2
    EvidenceButton
    UploadFileButton

<EvidenceButton>:
    cols: 2
    MDFillRoundFlatButton:
        text: 'Button 1'
        size: 150, 45
        size_hint: None, None
        font_size: '16dp'
        text_color: 1, 1, 1, 1
        md_bg_color: app.theme_cls.primary_color

<UploadFileButton>:
    cols: 2
    MDRoundFlatIconButton:
        text: 'Button 2'
        size: 150, 45
        size_hint: None, None
        font_size: '16dp'
        text_color: 1, 1, 1, 1
        md_bg_color: app.theme_cls.primary_color
eyllanesc
  • 235,170
  • 19
  • 170
  • 241
zupp
  • 96
  • 7

1 Answers1

0
from kivy.lang import Builder

from kivymd.app import MDApp

KV = '''
MDScreen:

    MDBoxLayout
        orientation: "vertical"
        spacing: "12dp"
        padding: "12dp"
        adaptive_height: True
        pos_hint: {"top": 1}

        MDTextFieldRect:
            size_hint: None, None
            size: button_box.width, "36dp"

        MDBoxLayout:
            id: button_box
            adaptive_size: True
            spacing: "12dp"
    
            MDRoundFlatIconButton:
                text: "MDRoundFlatIconButton"

            MDRoundFlatIconButton:
                text: "MDRoundFlatIconButton"
'''


class Example(MDApp):
    def build(self):
        return Builder.load_string(KV)


Example().run()
Xyanight
  • 1,315
  • 1
  • 7
  • 10