bokeh.core.property.override¶
Provide the Override class, for overriding base class property
attributes.
Note
This class should normally be imported from bokeh.core.properties
instead of directly from this module.
-
class
Override(**kwargs)[source]¶ Override attributes of Bokeh property in derived Models.
When subclassing a Bokeh Model, it may be desirable to change some of the attributes of the property itself, from those on the base class. This is accomplished using the
Overrideclass.Currently,
Overridecan only be use to override thedefaultvalue for the property.Keyword Arguments: default (obj) – a default value for this property on a subclass Example
Consider the following class definitions:
from bokeh.model import Model from bokeh.properties import Int, Override class Parent(Model): foo = Int(default=10) class Child(Parent): foo = Override(default=20)
The parent class has an integer property
foowith default value 10. The child class uses the following code:foo = Override(default=20)
to specify that the default value for the
fooproperty should be 20 on instances of the child class:>>> p = Parent() >>> p.foo 10 >>> c = Child() >>> c.foo 20