Returns a layout of the widgets and output arranged according to the center and widget location specified in the interactive call.
(self, **kwargs)
| 780 | return obj |
| 781 | |
| 782 | def layout(self, **kwargs): |
| 783 | """ |
| 784 | Returns a layout of the widgets and output arranged according |
| 785 | to the center and widget location specified in the |
| 786 | interactive call. |
| 787 | """ |
| 788 | widget_box = self.widgets() |
| 789 | panel = self.output() |
| 790 | loc = self._loc |
| 791 | center = self._center |
| 792 | alignments = { |
| 793 | 'left': (Row, ('start', 'center'), True), |
| 794 | 'right': (Row, ('end', 'center'), False), |
| 795 | 'top': (Column, ('center', 'start'), True), |
| 796 | 'bottom': (Column, ('center', 'end'), False), |
| 797 | 'top_left': (Column, 'start', True), |
| 798 | 'top_right': (Column, ('end', 'start'), True), |
| 799 | 'bottom_left': (Column, ('start', 'end'), False), |
| 800 | 'bottom_right': (Column, 'end', False), |
| 801 | 'left_top': (Row, 'start', True), |
| 802 | 'left_bottom': (Row, ('start', 'end'), True), |
| 803 | 'right_top': (Row, ('end', 'start'), False), |
| 804 | 'right_bottom': (Row, 'end', False), |
| 805 | } |
| 806 | layout, align, widget_first = alignments[loc] |
| 807 | widget_box.align = align |
| 808 | if not len(widget_box): |
| 809 | if center: |
| 810 | components = [HSpacer(), panel, HSpacer()] |
| 811 | else: |
| 812 | components = [panel] |
| 813 | return Row(*components, **kwargs) |
| 814 | |
| 815 | items = (widget_box, panel) if widget_first else (panel, widget_box) |
| 816 | sizing_mode = kwargs.get('sizing_mode') |
| 817 | if not center: |
| 818 | if layout is Row: |
| 819 | components = list(items) |
| 820 | else: |
| 821 | components = [layout(*items, sizing_mode=sizing_mode)] |
| 822 | elif layout is Column: |
| 823 | components = [HSpacer(), layout(*items, sizing_mode=sizing_mode), HSpacer()] |
| 824 | elif loc.startswith('left'): |
| 825 | components = [widget_box, HSpacer(), panel, HSpacer()] |
| 826 | else: |
| 827 | components = [HSpacer(), panel, HSpacer(), widget_box] |
| 828 | return Row(*components, **kwargs) |
| 829 | |
| 830 | def holoviews(self): |
| 831 | """ |