Reputation: 641
I understand Kivy ships with a color picker (kivy.uix.colorpicker), which is great and all, but I just want the wheel - the color wheel. That's all I want to have show in a certain space. The entire other half of the layout I don't need. At all.
Using kivy's KV, ColorWheel as a widget shows absolutely nothing, but doesn't throw any errors. I'm really confused because it seems as though the wheel itself is a pretty standalone widget (looking at the documentation) and I have no idea why I can't see it.
Help?
Upvotes: 4
Views: 1343
Reputation: 246
The ColorWheel object needs to trigger its "init_wheel" method to display something. And this is not done in its "init" method.
You also need to edit the "on_hsv" method to listen at the color selection.
This class inherits from the ColorWheel object and changes it to make it autonomous:
from kivy.uix.colorpicker import ColorWheel
class AutonomousColorWheel(ColorWheel):
def __init__(self, **kwarg):
super(AutonomousColorWheel, self).__init__(**kwarg)
self.init_wheel(dt = 0)
def on__hsv(self, instance, value):
super(AutonomousColorWheel, self).on__hsv(instance, value)
print(self.rgba) #Or any method you want to trigger
Hope it helps.
Upvotes: 6