<tfoot id='ITJHy'></tfoot>

        • <bdo id='ITJHy'></bdo><ul id='ITJHy'></ul>

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

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

        在kivy中更改按钮或标签文本颜色

        Change button or label text color in kivy(在kivy中更改按钮或标签文本颜色)

        <legend id='K5neS'><style id='K5neS'><dir id='K5neS'><q id='K5neS'></q></dir></style></legend>
            • <bdo id='K5neS'></bdo><ul id='K5neS'></ul>
                <tbody id='K5neS'></tbody>
            • <small id='K5neS'></small><noframes id='K5neS'>

                <tfoot id='K5neS'></tfoot>

                <i id='K5neS'><tr id='K5neS'><dt id='K5neS'><q id='K5neS'><span id='K5neS'><b id='K5neS'><form id='K5neS'><ins id='K5neS'></ins><ul id='K5neS'></ul><sub id='K5neS'></sub></form><legend id='K5neS'></legend><bdo id='K5neS'><pre id='K5neS'><center id='K5neS'></center></pre></bdo></b><th id='K5neS'></th></span></q></dt></tr></i><div id='K5neS'><tfoot id='K5neS'></tfoot><dl id='K5neS'><fieldset id='K5neS'></fieldset></dl></div>
                  本文介绍了在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中更改按钮或标签文本颜色的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                  相关文档推荐

                  Kivy 1.9.0 Windows package KeyError: #39;rthooks#39;(Kivy 1.9.0 Windows 包 KeyError: rthooks)
                  Python Kivy: how to call a function on button click?(Python Kivy:如何在按钮单击时调用函数?)
                  How to disable a widget in Kivy?(如何禁用 Kivy 中的小部件?)
                  Centering an object in Kivy(在 Kivy 中将对象居中)
                  How to downgrade to Python 3.4 from 3.5(如何从 Python 3.5 降级到 Python 3.4)
                  Kivy - Bind Label Text To Variable (Python Only)(Kivy - 将标签文本绑定到变量(仅限 Python))
                • <legend id='RZDy3'><style id='RZDy3'><dir id='RZDy3'><q id='RZDy3'></q></dir></style></legend>
                  <tfoot id='RZDy3'></tfoot>

                      <tbody id='RZDy3'></tbody>

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

                      • <bdo id='RZDy3'></bdo><ul id='RZDy3'></ul>

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