T
T
temagadfazer2019-08-25 15:25:46
Kivy
temagadfazer, 2019-08-25 15:25:46

Center an Icon inside a Python kivy button?

<Messenger>
    BoxLayout:
        orientation: 'vertical'
        BoxLayout:
            pos_hint: {'top': 1}
            size_hint: 1, 0.075
            orientation: 'horizontal'
            Button:
                Image:
                    source: 'params.png'
                    size_hint_y: None
                    size_hint_x: None
                    y: self.parent.y + self.parent.height/2
                    x: self.parent.x + self.parent.width/2
                    #heigth: self.parent.width/self.image_ratio
                    #heigth: self.parent.height
                    width: 30
                    keep_ratio: True
                    allow_stretch: True
            Button:
                text: 'button'
            Button:
                text: 'button'
        BoxLayout:
            orientation: 'vertical'
            Button:
                text: 'button'

Hello everyone, I'm learning kivy, now I want to write a small program, but I just can't figure out how to place the icon inside the button so that the icon is strictly in the middle. I would like to see at the top a line of three buttons, such as a header, and below the rest of the working field. If anything, then Messenger is inherited from Screen, suddenly this is important.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Albert, 2019-09-16
@bigburn

ButtonBehavior doesn't work? https://kivy.org/doc/stable/api-kivy.uix.behaviors...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question