Passing image object as a button background in Kivy

前端 未结 3 689
伪装坚强ぢ
伪装坚强ぢ 2021-02-08 01:52

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 w

3条回答
  •  野趣味
    野趣味 (楼主)
    2021-02-08 02:31

    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
    

提交回复
热议问题