In Kivy, is there a way to pass image object as a button background, instead of image file name?
button.background_normal
property accepts only strings. I would like to customize image properties, such as allow_stretch = False
.
If that succeeds, how can I specify image alignment inside a button, eg. to make it top-left aligned?
You can use
Button:
id:mybutton
background_down: "bgdown.png"
background_normal: "bg.png"
In addition to toto_tico's answer, you can locate the image at the center of the button as:
Button:
id: myButton
Image:
source: "./buttonImage.PNG"
center_x: self.parent.center_x
center_y: self.parent.center_y
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With