Table Of Contents
Color Picker¶
New in version 1.7.0.
Warning
This widget is experimental. Its use and API can change at any time until this warning is removed.
The ColorPicker widget allows a user to select a color from a chromatic wheel where pinch and zoom can be used to change the wheel’s saturation. Sliders and TextInputs are also provided for entering the RGBA/HSV/HEX values directly.
Usage:
clr_picker = ColorPicker()
parent.add_widget(clr_picker)
# To monitor changes, we can bind to color property changes
def on_color(instance, value):
print "RGBA = ", str(value) # or instance.color
print "HSV = ", str(instance.hsv)
print "HEX = ", str(instance.hex_color)
clr_picker.bind(color=on_color)
-
class
kivy.uix.colorpicker.ColorPicker(**kwargs)[source]¶ Bases:
kivy.uix.relativelayout.RelativeLayoutSee module documentation.
-
color¶ The
colorholds the color currently selected in rgba format.coloris aListPropertyand defaults to (1, 1, 1, 1).
-
font_name¶ Specifies the font used on the ColorPicker.
font_nameis aStringPropertyand defaults to ‘data/fonts/RobotoMono-Regular.ttf’.
-
hex_color¶ The
hex_colorholds the currently selected color in hex.hex_coloris anAliasPropertyand defaults to #ffffffff.
-
hsv¶ The
hsvholds the color currently selected in hsv format.hsvis aListPropertyand defaults to (1, 1, 1).
-
wheel¶ The
wheelholds the color wheel.wheelis anObjectPropertyand defaults to None.
-
-
class
kivy.uix.colorpicker.ColorWheel(**kwargs)[source]¶ Bases:
kivy.uix.widget.WidgetChromatic wheel for the ColorPicker.
Changed in version 1.7.1: font_size, font_name and foreground_color have been removed. The sizing is now the same as others widget, based on ‘sp’. Orientation is also automatically determined according to the width/height ratio.
-
a¶ The Alpha value of the color currently selected.
ais aBoundedNumericPropertyand can be a value from 0 to 1.
-
b¶ The Blue value of the color currently selected.
bis aBoundedNumericPropertyand can be a value from 0 to 1.
-
color¶ The holds the color currently selected.
coloris aReferenceListPropertyand contains a list of r, g, b, a values.
-
g¶ The Green value of the color currently selected.
gis aBoundedNumericPropertyand can be a value from 0 to 1.
-
on_touch_down(touch)[source]¶ Receive a touch down event.
Parameters: - touch:
MotionEventclass Touch received. The touch is in parent coordinates. See
relativelayoutfor a discussion on coordinate systems.
Returns: bool If True, the dispatching of the touch event will stop. If False, the event will continue to be dispatched to the rest of the widget tree.
- touch:
-
on_touch_move(touch)[source]¶ Receive a touch move event. The touch is in parent coordinates.
See
on_touch_down()for more information.
-
on_touch_up(touch)[source]¶ Receive a touch up event. The touch is in parent coordinates.
See
on_touch_down()for more information.
-
r¶ The Red value of the color currently selected.
ris aBoundedNumericPropertyand can be a value from 0 to 1. It defaults to 0.
-