In the following code the ellipse gets displayed with no transparency
(alpha=1). Probably when self.color
changes, the alpha is set to 1 (interestingly
this doesn't happen if the color is set to (1,1,1)
in the setup method).
Is there a way to change the color without changing the alpha?
I would like to set the alpha in the kv file and change the color from python.
Thanks
alpha.kv:
#:kivy 1.9.1
<MyWidget>:
color: 1,1,1
canvas:
Color:
hsv: self.color
a: 0.3
Ellipse:
pos: (200, 200)
size: (30, 30)
main.py:
from kivy.app import App
from kivy.uix.widget import Widget
from kivy.properties import NumericProperty, ReferenceListProperty
class MyWidget(Widget):
colorH = NumericProperty(1)
colorS = NumericProperty(1)
colorV = NumericProperty(1)
color = ReferenceListProperty(colorH,colorS,colorV)
def setup(self):
self.color = (0.5,1,1)
# self.color = (1,1,1) # here the alpha doesn't change
class AlphaApp(App):
def build(self):
w = MyWidget()
w.setup()
return w
if __name__ == '__main__':
AlphaApp().run()