HEJ
我喜欢为用于绘制多个GUI组背景的颜色定义模板。
我的kivy kv代码看起来像这样:
<BGRcolor@Color>: rgb: 0.176, 0.176, 0.176 <myParamBox@BoxLayout>: canvas: BGRcolor: Rectangle: pos: root.pos size: root.size Color: rgb: 0.3, 0.3, 0.3 Line: points: root.pos[0],root.pos[1], root.pos[0] + root.size[0],root.pos[1], root.pos[0] + root.size[0],root.pos[1] + root.size[1], root.pos[0] ,root.pos[1] + root.size[1], root.pos[0],root.pos[1] padding: 2画布操作的颜色设置不起作用。 有任何想法吗?
Hej
I like to define a template for a color used to draw backgrounds of several GUI groups.
My kivy kv code looks like this:
<BGRcolor@Color>: rgb: 0.176, 0.176, 0.176 <myParamBox@BoxLayout>: canvas: BGRcolor: Rectangle: pos: root.pos size: root.size Color: rgb: 0.3, 0.3, 0.3 Line: points: root.pos[0],root.pos[1], root.pos[0] + root.size[0],root.pos[1], root.pos[0] + root.size[0],root.pos[1] + root.size[1], root.pos[0] ,root.pos[1] + root.size[1], root.pos[0],root.pos[1] padding: 2The setting of the Color for the canvas operation does not work. Any Ideas?
最满意答案
颜色不是Widget,因此您无法像这样构造它。 实际上并没有真正的语法可以让它更简洁,但你可以制作所有想要让这种颜色的小部件继承自另一个具有Color规则的Widget。
Color is not a Widget, so you can't construct it like this. Actually there isn't really a syntax to make this directly more concise, but you could e.g. make all the widgets you want to have this color inherit from another Widget that has the Color rule.
如何将模板颜色设置为kivy UI的画布?(How to set a template color to a canvas of a kivy UI?)HEJ
我喜欢为用于绘制多个GUI组背景的颜色定义模板。
我的kivy kv代码看起来像这样:
<BGRcolor@Color>: rgb: 0.176, 0.176, 0.176 <myParamBox@BoxLayout>: canvas: BGRcolor: Rectangle: pos: root.pos size: root.size Color: rgb: 0.3, 0.3, 0.3 Line: points: root.pos[0],root.pos[1], root.pos[0] + root.size[0],root.pos[1], root.pos[0] + root.size[0],root.pos[1] + root.size[1], root.pos[0] ,root.pos[1] + root.size[1], root.pos[0],root.pos[1] padding: 2画布操作的颜色设置不起作用。 有任何想法吗?
Hej
I like to define a template for a color used to draw backgrounds of several GUI groups.
My kivy kv code looks like this:
<BGRcolor@Color>: rgb: 0.176, 0.176, 0.176 <myParamBox@BoxLayout>: canvas: BGRcolor: Rectangle: pos: root.pos size: root.size Color: rgb: 0.3, 0.3, 0.3 Line: points: root.pos[0],root.pos[1], root.pos[0] + root.size[0],root.pos[1], root.pos[0] + root.size[0],root.pos[1] + root.size[1], root.pos[0] ,root.pos[1] + root.size[1], root.pos[0],root.pos[1] padding: 2The setting of the Color for the canvas operation does not work. Any Ideas?
最满意答案
颜色不是Widget,因此您无法像这样构造它。 实际上并没有真正的语法可以让它更简洁,但你可以制作所有想要让这种颜色的小部件继承自另一个具有Color规则的Widget。
Color is not a Widget, so you can't construct it like this. Actually there isn't really a syntax to make this directly more concise, but you could e.g. make all the widgets you want to have this color inherit from another Widget that has the Color rule.
发布评论