ラベルの文字の色

2015/11/01

Python 2.7.9, Kivy 1.9.0

Kvファイルでこんな感じ

Label:
    text: 'color'
    color: 1, 1, 1, 1


colorは(r, g, b, a)で0~1.0の間の値

Label — Kivy 1.9.1-dev documentation
http://kivy.org/docs/api-kivy.uix.label.html#kivy.uix.label.Label.color


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

from kivy.app import App
from kivy.uix.boxlayout import BoxLayout
from kivy.lang import Builder

kv = """
Label:
    text: "Hello World"
    color: 1, 0, 1, 1
"""

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

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