ボタンに画像を使う

2015/10/24

Python 2.7.9, Kivy 1.9.0

# -*- coding: utf-8 -*-

from kivy.app import App
from kivy.lang import Builder

kv = '''
AnchorLayout:
    anchor_x: 'center'
    anchor_y: 'center'
    Button:
        size: 200, 200
        size_hint: None, None
        Image:
            source: "kivy-logo-black-256.png"
            center_x: self.parent.center_x
            center_y: self.parent.center_y
'''

class MyApp(App):
    def build(self):
        return Builder.load_string(kv)

if __name__ == '__main__':
    MyApp().run()

Passing image object as a button background in Kivy
http://stackoverflow.com/questions/17392202/passing-image-object-as-a-button-background-in-kivy