<legend id='NEgRw'><style id='NEgRw'><dir id='NEgRw'><q id='NEgRw'></q></dir></style></legend>

      <bdo id='NEgRw'></bdo><ul id='NEgRw'></ul>
    <i id='NEgRw'><tr id='NEgRw'><dt id='NEgRw'><q id='NEgRw'><span id='NEgRw'><b id='NEgRw'><form id='NEgRw'><ins id='NEgRw'></ins><ul id='NEgRw'></ul><sub id='NEgRw'></sub></form><legend id='NEgRw'></legend><bdo id='NEgRw'><pre id='NEgRw'><center id='NEgRw'></center></pre></bdo></b><th id='NEgRw'></th></span></q></dt></tr></i><div id='NEgRw'><tfoot id='NEgRw'></tfoot><dl id='NEgRw'><fieldset id='NEgRw'></fieldset></dl></div>

    <small id='NEgRw'></small><noframes id='NEgRw'>

    1. <tfoot id='NEgRw'></tfoot>
    2. 在kivy中更改按钮或标签文本颜色

      时间:2023-10-10

      <small id='pvU44'></small><noframes id='pvU44'>

      <i id='pvU44'><tr id='pvU44'><dt id='pvU44'><q id='pvU44'><span id='pvU44'><b id='pvU44'><form id='pvU44'><ins id='pvU44'></ins><ul id='pvU44'></ul><sub id='pvU44'></sub></form><legend id='pvU44'></legend><bdo id='pvU44'><pre id='pvU44'><center id='pvU44'></center></pre></bdo></b><th id='pvU44'></th></span></q></dt></tr></i><div id='pvU44'><tfoot id='pvU44'></tfoot><dl id='pvU44'><fieldset id='pvU44'></fieldset></dl></div>

      <legend id='pvU44'><style id='pvU44'><dir id='pvU44'><q id='pvU44'></q></dir></style></legend>

          <bdo id='pvU44'></bdo><ul id='pvU44'></ul>

            <tfoot id='pvU44'></tfoot>
              <tbody id='pvU44'></tbody>

              1. 本文介绍了在kivy中更改按钮或标签文本颜色的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

                问题描述

                我正在关注 这本 kivy 书,虽然我能理解如何更改按钮的背景颜色,我没有找到更改文本颜色的关键字.

                I'm following this kivy book, and while I can understand how to change the background color of buttons, I haven't found the keyword to change the text color.

                我看到了 这个和 其他问题.这是我的代码:

                I saw this and other questions. Here's my code:

                #!/usr/bin/kivy
                import kivy
                kivy.require('1.7.2')
                
                from random import random
                from kivy.app import App
                from kivy.uix.widget import Widget
                from kivy.uix.gridlayout import GridLayout
                from kivy.graphics import Color, Ellipse, Rectangle
                
                class MinimalApp(App):
                    title = 'My App'
                    def build(self):
                        root = RootLayout()
                        return(root)
                
                class RootLayout(GridLayout):
                    pass
                
                if __name__ == '__main__':
                    MinimalApp().run()
                

                在 .kv 文件中:

                #:kivy 1.7.2
                #:import kivy kivy
                
                <RootLayout>:
                    rows: 1
                    Label:
                        text: "Why does this not work?"
                #        rgba: 1,0,1,1                  # doesn't work
                #        Color:                         # doesn't work
                #                rgba: 1,0,1,1          # doesn't work
                #       font_color: rgba: 1,0,1,1
                        canvas.before:
                            Color:
                                rgba: 0, 0, 0, 1
                            Rectangle:
                                pos: self.pos
                                size: self.size
                

                推荐答案

                使用color(全部小写):

                Use color (all lowercase):

                <RootLayout>:
                    rows: 1
                    Label:
                        text: "Why does this not work?"
                        color: 1,0,1,1 # <-----------
                        canvas.before:
                            Color:
                                rgba: 0, 0, 0, 1
                            Rectangle:
                                pos: self.pos
                                size: self.size
                

                这篇关于在kivy中更改按钮或标签文本颜色的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!

                上一篇:Kivy - 将标签文本绑定到变量(仅限 Python) 下一篇:如何从 Python 3.5 降级到 Python 3.4

                相关文章

                最新文章

                  <legend id='z8CMf'><style id='z8CMf'><dir id='z8CMf'><q id='z8CMf'></q></dir></style></legend>
                  <i id='z8CMf'><tr id='z8CMf'><dt id='z8CMf'><q id='z8CMf'><span id='z8CMf'><b id='z8CMf'><form id='z8CMf'><ins id='z8CMf'></ins><ul id='z8CMf'></ul><sub id='z8CMf'></sub></form><legend id='z8CMf'></legend><bdo id='z8CMf'><pre id='z8CMf'><center id='z8CMf'></center></pre></bdo></b><th id='z8CMf'></th></span></q></dt></tr></i><div id='z8CMf'><tfoot id='z8CMf'></tfoot><dl id='z8CMf'><fieldset id='z8CMf'></fieldset></dl></div>

                      <bdo id='z8CMf'></bdo><ul id='z8CMf'></ul>

                    <small id='z8CMf'></small><noframes id='z8CMf'>

                  1. <tfoot id='z8CMf'></tfoot>