bokeh.core.enums#
Common enumerations to be used together with Enum property.
This module provides many pre-defined enumerations, as well as functions for creating new enumerations.
New enumerations can be created using the enumeration() function:
#: Specify a nautically named side, port or starboard
MyEnum = enumeration("port", "starboard")
Typically, enumerations are used to define Enum properties:
from bokeh.model import Model
from bokeh.core.properties import Enum
class MyModel(Model):
location = Enum(MyEnum, help="""
Whether the thing should be a port or starboard.
""")
Enumerations have a defined order and support iteration:
>>> for loc in MyEnum:
... print(loc)
...
port
starboard
as well as containment tests:
>>> "port" in MyEnum
True
- enumeration(*values: Any, case_sensitive: bool = True, quote: bool = False) Enumeration[source]#
Create an
enumeration()object from a sequence of values.Call
enumerationwith a sequence of (unique) strings to create an Enumeration object:#: Specify the horizontal alignment for rendering text TextAlign = enumeration("left", "right", "center") #: Specify either ascending or descending item order AscDesc = enumeration(1, -1)
- Parameters:
string or integer enumeration values, passed as positional arguments
The order of arguments is the order of the enumeration, and the first element will be considered the default value when used to create
Enumproperties.case_sensitive (bool, optional) – Whether validation should consider case or not (default: True)
quote (bool, optional) – Whether values should be quoted in the string representations (default: False)
- Raises:
ValueError if values empty, if any value is not a string or not unique –
- Returns:
Enumeration
- NamedColor = Enumeration(aliceblue, antiquewhite, aqua, aquamarine, azure, beige, bisque, black, blanchedalmond, blue, blueviolet, brown, burlywood, cadetblue, chartreuse, chocolate, coral, cornflowerblue, cornsilk, crimson, cyan, darkblue, darkcyan, darkgoldenrod, darkgray, darkgreen, darkgrey, darkkhaki, darkmagenta, darkolivegreen, darkorange, darkorchid, darkred, darksalmon, darkseagreen, darkslateblue, darkslategray, darkslategrey, darkturquoise, darkviolet, deeppink, deepskyblue, dimgray, dimgrey, dodgerblue, firebrick, floralwhite, forestgreen, fuchsia, gainsboro, ghostwhite, gold, goldenrod, gray, green, greenyellow, grey, honeydew, hotpink, indianred, indigo, ivory, khaki, lavender, lavenderblush, lawngreen, lemonchiffon, lightblue, lightcoral, lightcyan, lightgoldenrodyellow, lightgray, lightgreen, lightgrey, lightpink, lightsalmon, lightseagreen, lightskyblue, lightslategray, lightslategrey, lightsteelblue, lightyellow, lime, limegreen, linen, magenta, maroon, mediumaquamarine, mediumblue, mediumorchid, mediumpurple, mediumseagreen, mediumslateblue, mediumspringgreen, mediumturquoise, mediumvioletred, midnightblue, mintcream, mistyrose, moccasin, navajowhite, navy, oldlace, olive, olivedrab, orange, orangered, orchid, palegoldenrod, palegreen, paleturquoise, palevioletred, papayawhip, peachpuff, peru, pink, plum, powderblue, purple, rebeccapurple, red, rosybrown, royalblue, saddlebrown, salmon, sandybrown, seagreen, seashell, sienna, silver, skyblue, slateblue, slategray, slategrey, snow, springgreen, steelblue, tan, teal, thistle, tomato, turquoise, violet, wheat, white, whitesmoke, yellow, yellowgreen)#
//www.w3.org/TR/css-color-4/#named-colors)
- Type:
Specify one of the CSS4 named colors (https