【问题标题】:Kv custom class in kivy jbhdfkjadkvbfjaskivy jbhdfkjadkvbfjas 中的 Kv 自定义类
【发布时间】:2016-02-19 04:49:15
【问题描述】:

我正在尝试创建一个在 .kv 文件中显示 3 个带有自定义类的按钮的 kv:但在应用程序中有 3 个没有颜色和文本的按钮

SimpleKivy.kv:

<Buttond@Button>:
   color: 0,0,1,0

<Layoutt>:
   Buttond:
       size: 100, 100
       pos: 350,150
       text: "sdciao"
   Buttond:
       size: 100, 100
       pos: 250,150
       text: "sciao"
   Buttond:
       size: 100, 100
       pos: 100,150
       text: "dsciao"

这里是prova.py:

import kivy
kivy.require("1.9.0")
from kivy.app import App
from kivy.uix.label import Label
from kivy.uix.button import Button
from kivy.uix.gridlayout import GridLayout
class Layoutt(GridLayout):
class SimpleKivy(App):
     def build(self):
          return Layoutt()
 SimpleKivy().run()

编辑: 使用 color:0,0,1 文本出现,但它不想改变颜色

【问题讨论】:

  • 抱歉,问题出在使用的数字上,0,0,0,0 我认为它是黑色的,所以在按钮上看不到(黑色背景)

标签: android ios kivy


【解决方案1】:

颜色:0,0,1,0

这是一种 rgba 颜色,a (alpha) 为 0,因此它是透明的,您什么也看不到。

【讨论】:

    猜你喜欢
    • 2018-11-04
    • 1970-01-01
    • 1970-01-01
    • 2015-07-10
    • 1970-01-01
    • 2019-01-21
    • 1970-01-01
    • 1970-01-01
    • 2023-02-13
    相关资源
    最近更新 更多