更改按钮Kivy中文本的颜色

时间:2019-11-29 18:36:30

标签: python python-3.x kivy kivy-language

我是Kivy的新手,所以我认为这是一件非常简单的事情,但是我无法弄清楚。 我有这个.kv文件:

#:kivy 1.0.9
#:import hex kivy.utils.get_color_from_hex
#:import sp kivy.metrics.sp

<RoundedButton@Button>:
    radius: 0
    color: 1,1,1,1
    color_pressed: .5,.5,.5,.5

    background_color: 0,0,0,0  # the last zero is the critical on, make invisible
    canvas.before:
        Color:
            rgba: (self.color) if self.state=='normal' else (self.color_pressed)  # visual feedback of press
        RoundedRectangle:
            pos: self.pos
            size: self.size
            radius: [self.radius,]


<MenuScreen>
    button:btn
    RoundedButton:
        id:btn
        color: hex('#e056fdff')
        color_pressed: hex('#7e0297')
        radius: 8
        size_hint: 0.75, 0.16
        pos_hint: {"x":0.125, "y":0.345}
        text: "Click Me"

我正在尝试更改按钮中文本的颜色。 我该怎么办?

谢谢!

0 个答案:

没有答案