1
"""
2
Spacer components to add horizontal or vertical space to a layout. 
3
"""
4

5 2
import param
6

7 2
from bokeh.models import Div as BkDiv, Spacer as BkSpacer
8

9 2
from ..reactive import Reactive
10

11

12 2
class Spacer(Reactive):
13
    """Empty object used to control formatting (using positive or negative space)"""
14

15 2
    _bokeh_model = BkSpacer
16

17 2
    def _get_model(self, doc, root=None, parent=None, comm=None):
18 2
        properties = self._process_param_change(self._init_properties())
19 2
        model = self._bokeh_model(**properties)
20 2
        if root is None:
21 2
            root = model
22 2
        self._models[root.ref['id']] = (model, parent)
23 2
        return model
24

25

26 2
class VSpacer(Spacer):
27
    """
28
    Spacer which automatically fills all available vertical space.
29
    """
30

31 2
    sizing_mode = param.Parameter(default='stretch_height', readonly=True)
32

33

34 2
class HSpacer(Spacer):
35
    """
36
    Spacer which automatically fills all available horizontal space.
37
    """
38

39 2
    sizing_mode = param.Parameter(default='stretch_width', readonly=True)
40

41

42 2
class Divider(Reactive):
43
    """A Divider line"""
44

45 2
    width_policy = param.ObjectSelector(default="fit", readonly=True)
46

47 2
    _bokeh_model = BkDiv
48

49 2
    def _get_model(self, doc, root=None, parent=None, comm=None):
50 0
        properties = self._process_param_change(self._init_properties())
51 0
        properties['style'] = {'width': '100%', 'height': '100%'}
52 0
        model = self._bokeh_model(text='<hr style="margin: 0px">', **properties)
53 0
        if root is None:
54 0
            root = model
55 0
        self._models[root.ref['id']] = (model, parent)
56 0
        return model

Read our documentation on viewing source code .

Loading