How to use the ipywidgets.Box function in ipywidgets

To help you get started, we’ve selected a few ipywidgets examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github rheiland / xml2jupyter / tests / user_params_baseline_cancer_biobots.py View on Github external
row25 = [param_name25, self.attachment_receptor_threshold, units_button25, desc_button25] 
        row26 = [param_name26, self.max_attachment_distance, units_button26, desc_button26] 
        row27 = [param_name27, self.min_attachment_distance, units_button27, desc_button27] 
        row28 = [param_name28, self.motility_shutdown_detection_threshold, units_button28, desc_button28] 
        row29 = [param_name29, self.attached_worker_migration_bias, units_button29, desc_button29] 
        row30 = [param_name30, self.unattached_worker_migration_bias, units_button30, desc_button30] 

        box_layout = Layout(display='flex', flex_flow='row', align_items='stretch', width='100%')
        box1 = Box(children=row1, layout=box_layout)
        box2 = Box(children=row2, layout=box_layout)
        box3 = Box(children=row3, layout=box_layout)
        box4 = Box(children=row4, layout=box_layout)
        box5 = Box(children=row5, layout=box_layout)
        box6 = Box(children=row6, layout=box_layout)
        box7 = Box(children=row7, layout=box_layout)
        box8 = Box(children=row8, layout=box_layout)
        box9 = Box(children=row9, layout=box_layout)
        box10 = Box(children=row10, layout=box_layout)
        box11 = Box(children=row11, layout=box_layout)
        box12 = Box(children=row12, layout=box_layout)
        box13 = Box(children=row13, layout=box_layout)
        box14 = Box(children=row14, layout=box_layout)
        box15 = Box(children=row15, layout=box_layout)
        box16 = Box(children=row16, layout=box_layout)
        box17 = Box(children=row17, layout=box_layout)
        box18 = Box(children=row18, layout=box_layout)
        box19 = Box(children=row19, layout=box_layout)
        box20 = Box(children=row20, layout=box_layout)
        box21 = Box(children=row21, layout=box_layout)
        box22 = Box(children=row22, layout=box_layout)
        box23 = Box(children=row23, layout=box_layout)
        box24 = Box(children=row24, layout=box_layout)
github rheiland / xml2jupyter / tests / user_params_baseline_cancer_biobots.py View on Github external
row27 = [param_name27, self.min_attachment_distance, units_button27, desc_button27] 
        row28 = [param_name28, self.motility_shutdown_detection_threshold, units_button28, desc_button28] 
        row29 = [param_name29, self.attached_worker_migration_bias, units_button29, desc_button29] 
        row30 = [param_name30, self.unattached_worker_migration_bias, units_button30, desc_button30] 

        box_layout = Layout(display='flex', flex_flow='row', align_items='stretch', width='100%')
        box1 = Box(children=row1, layout=box_layout)
        box2 = Box(children=row2, layout=box_layout)
        box3 = Box(children=row3, layout=box_layout)
        box4 = Box(children=row4, layout=box_layout)
        box5 = Box(children=row5, layout=box_layout)
        box6 = Box(children=row6, layout=box_layout)
        box7 = Box(children=row7, layout=box_layout)
        box8 = Box(children=row8, layout=box_layout)
        box9 = Box(children=row9, layout=box_layout)
        box10 = Box(children=row10, layout=box_layout)
        box11 = Box(children=row11, layout=box_layout)
        box12 = Box(children=row12, layout=box_layout)
        box13 = Box(children=row13, layout=box_layout)
        box14 = Box(children=row14, layout=box_layout)
        box15 = Box(children=row15, layout=box_layout)
        box16 = Box(children=row16, layout=box_layout)
        box17 = Box(children=row17, layout=box_layout)
        box18 = Box(children=row18, layout=box_layout)
        box19 = Box(children=row19, layout=box_layout)
        box20 = Box(children=row20, layout=box_layout)
        box21 = Box(children=row21, layout=box_layout)
        box22 = Box(children=row22, layout=box_layout)
        box23 = Box(children=row23, layout=box_layout)
        box24 = Box(children=row24, layout=box_layout)
        box25 = Box(children=row25, layout=box_layout)
        box26 = Box(children=row26, layout=box_layout)
github rheiland / xml2jupyter / tests / user_params_baseline_cancer_immune.py View on Github external
row20 = [param_name20, self.tumor_immunogenicity_standard_deviation, units_button20, desc_button20] 
        row21 = [param_name21, self.oncoprotein_saturation, units_button21, desc_button21] 
        row22 = [param_name22, self.oncoprotein_threshold, units_button22, desc_button22] 
        row23 = [param_name23, self.max_attachment_distance, units_button23, desc_button23] 
        row24 = [param_name24, self.min_attachment_distance, units_button24, desc_button24] 

        box_layout = Layout(display='flex', flex_flow='row', align_items='stretch', width='100%')
        box1 = Box(children=row1, layout=box_layout)
        box2 = Box(children=row2, layout=box_layout)
        box3 = Box(children=row3, layout=box_layout)
        box4 = Box(children=row4, layout=box_layout)
        box5 = Box(children=row5, layout=box_layout)
        box6 = Box(children=row6, layout=box_layout)
        box7 = Box(children=row7, layout=box_layout)
        box8 = Box(children=row8, layout=box_layout)
        box9 = Box(children=row9, layout=box_layout)
        box10 = Box(children=row10, layout=box_layout)
        box11 = Box(children=row11, layout=box_layout)
        box12 = Box(children=row12, layout=box_layout)
        box13 = Box(children=row13, layout=box_layout)
        box14 = Box(children=row14, layout=box_layout)
        box15 = Box(children=row15, layout=box_layout)
        box16 = Box(children=row16, layout=box_layout)
        box17 = Box(children=row17, layout=box_layout)
        box18 = Box(children=row18, layout=box_layout)
        box19 = Box(children=row19, layout=box_layout)
        box20 = Box(children=row20, layout=box_layout)
        box21 = Box(children=row21, layout=box_layout)
        box22 = Box(children=row22, layout=box_layout)
        box23 = Box(children=row23, layout=box_layout)
        box24 = Box(children=row24, layout=box_layout)
github rheiland / xml2jupyter / tests / user_params_baseline_cancer_immune.py View on Github external
box9 = Box(children=row9, layout=box_layout)
        box10 = Box(children=row10, layout=box_layout)
        box11 = Box(children=row11, layout=box_layout)
        box12 = Box(children=row12, layout=box_layout)
        box13 = Box(children=row13, layout=box_layout)
        box14 = Box(children=row14, layout=box_layout)
        box15 = Box(children=row15, layout=box_layout)
        box16 = Box(children=row16, layout=box_layout)
        box17 = Box(children=row17, layout=box_layout)
        box18 = Box(children=row18, layout=box_layout)
        box19 = Box(children=row19, layout=box_layout)
        box20 = Box(children=row20, layout=box_layout)
        box21 = Box(children=row21, layout=box_layout)
        box22 = Box(children=row22, layout=box_layout)
        box23 = Box(children=row23, layout=box_layout)
        box24 = Box(children=row24, layout=box_layout)

        self.tab = VBox([
          box1,
          box2,
          box3,
          box4,
          box5,
          box6,
          box7,
          box8,
          box9,
          box10,
          box11,
          box12,
          box13,
          box14,
github bernhard-42 / jupyter-cadquery / jupyter_cadquery / cad_display.py View on Github external
zoom=2.5,
                mac_scrollbar=True,
                timeit=False):

        if platform.system() != "Darwin":
            mac_scrollbar = False

        # Output widget
        output_height = height * 0.4 - 20 + 2
        self.info = Info(tree_width, output_height - 6)

        self.info.html.add_class("scroll-area")
        if mac_scrollbar:
            self.info.html.add_class("mac-scrollbar")

        self.output = Box([self.info.html])
        self.output.layout = Layout(
            height="%dpx" % output_height, width="%dpx" % tree_width, overflow_y="scroll", overflow_x="scroll")

        self.output.add_class("view_output")

        ## Threejs rendering of Cadquery objects
        self.cq_view = CadqueryView(
            width=cad_width,
            height=height,
            quality=quality,
            edge_accuracy=edge_accuracy,
            default_mesh_color=self.default_mesh_color,
            default_edge_color=self.default_edge_color,
            info=self.info,
            timeit=timeit)
github rheiland / xml2jupyter / PhysiCell_GUI / user_params.py View on Github external
box2 = Box(children=row2, layout=box_layout)
        box3 = Box(children=row3, layout=box_layout)
        box4 = Box(children=row4, layout=box_layout)
        box5 = Box(children=row5, layout=box_layout)
        box6 = Box(children=row6, layout=box_layout)
        box7 = Box(children=row7, layout=box_layout)
        box8 = Box(children=row8, layout=box_layout)
        box9 = Box(children=row9, layout=box_layout)
        box10 = Box(children=row10, layout=box_layout)
        box11 = Box(children=row11, layout=box_layout)
        box12 = Box(children=row12, layout=box_layout)
        box13 = Box(children=row13, layout=box_layout)
        box14 = Box(children=row14, layout=box_layout)
        box15 = Box(children=row15, layout=box_layout)
        box16 = Box(children=row16, layout=box_layout)
        box17 = Box(children=row17, layout=box_layout)
        box18 = Box(children=row18, layout=box_layout)
        box19 = Box(children=row19, layout=box_layout)
        box20 = Box(children=row20, layout=box_layout)
        box21 = Box(children=row21, layout=box_layout)
        box22 = Box(children=row22, layout=box_layout)
        box23 = Box(children=row23, layout=box_layout)
        box24 = Box(children=row24, layout=box_layout)
        box25 = Box(children=row25, layout=box_layout)
        box26 = Box(children=row26, layout=box_layout)
        box27 = Box(children=row27, layout=box_layout)
        box28 = Box(children=row28, layout=box_layout)
        box29 = Box(children=row29, layout=box_layout)

        self.tab = VBox([
          box1,
          box2,
github Autodesk / notebook-molecular-visualization / nbmolviz / widgets / orbitals.py View on Github external
Subclass of the standard geometry viewer with added UI for rendering orbitals

    Args:
        mol (mdt.Molecule): a molecule with A) orbitals, and
                            B) an energy model with calculate_orbital_grid
        **kwargs (dict): kwargs for the viewer
    """
    def __init__(self, mol, **kwargs):
        self.viewer = GeometryViewer(mol=mol, **process_widget_kwargs(kwargs))
        self.viewer.wfns = [mol.wfn]
        self.uipane = OrbitalUIPane(self, hostheight=self.viewer.layout.height)
        hb = HBox([self.viewer, self.uipane])
        super(OrbitalViewer, self).__init__([hb])


class OrbitalUIPane(Selector, ipy.Box):
    # TODO: deal with orbitals not present in all frames of a trajectory
    # TODO: deal with orbital properties (occupation and energy) changing over a trajectory
    def __init__(self, viz, hostheight, **kwargs):
        self.viz = viz
        kwargs.setdefault('width', '325px')

        self.type_dropdown = ipy.Dropdown(options=list(self.viz.viewer.wfn.orbitals.keys()))
        initial_orb = 'canonical'
        if initial_orb not in self.type_dropdown.options:
            initial_orb = next(iter(self.type_dropdown.options.keys()))
        self.type_dropdown.value = initial_orb
        self.type_dropdown.observe(self.new_orb_type, 'value')

        kwargs['height'] = str(int(hostheight.rstrip('px')) - 50) + 'px'
        height = str(int(hostheight.rstrip('px')) - 125) + 'px'
github Autodesk / notebook-molecular-visualization / nbmolviz / mdtconfig / compute.py View on Github external
def __init__(self):
        from .docker import DockerConfig
        from .interfaces import InterfaceStatus
        from .visualization import MdtExtensionConfig

        self.interface_status = InterfaceStatus()
        self.compute_config = DockerConfig()
        self.nbextension_config = MdtExtensionConfig()
        self.changelog = ChangeLog()
        self.tab_list = StyledTab([ipy.Box(),
                                   self.nbextension_config,
                                   self.interface_status,
                                   self.compute_config,
                                   self.changelog])
        self.tab_list.set_title(0, '^')
        self.tab_list.set_title(1, 'Notebook config')
        self.tab_list.set_title(2, "Interfaces")
        self.tab_list.set_title(3, 'Docker config')
        self.tab_list.set_title(4, "What's new")
        self.children = [self.make_header(), self.tab_list]
        super().__init__(children=self.children)
github mwcraig / reducer / reducer / gui.py View on Github external
toggle_types = {'checkbox': CheckboxPlus,
                        'button': widgets.ToggleButton}
        toggle_type = kwd.pop('toggle_type', 'checkbox')
        if toggle_type not in toggle_types:
            raise ValueError('toggle_type must be one of '
                             '{}'.format(toggle_type.keys()))
        super(ToggleContainer, self).__init__(*args, **kwd)
        self._toggle_container = widgets.Box()
        # Boxes no longer have a description in ipywidgets 7 so add one here
        self._toggle_container.description = 'toggle holder'
        self._checkbox = toggle_types[toggle_type](description=self.description)
        self._toggle_container.children = [self._checkbox]
        self._container = widgets.VBox()
        # Boxes no longer have a description in ipywidgets 7 so add one here
        self._container.description = "Toggle-able container"
        self._state_monitor_container = widgets.Box(visibility='hidden')
        # Boxes no longer have a description in ipywidgets 7 so add one here
        self._state_monitor_container.description = "For internal use only"
        self._state_monitor_container.layout.visibility = 'hidden'
        self._state_monitor_container.display = 'none'
        self._state_monitor = widgets.Checkbox(visibility='hidden')
        self._state_monitor.layout.visibility = 'hidden'
        self._state_monitor.layout.display = 'none'
        self._state_monitor_container.children = [self._state_monitor]

        self.children = [
            self._toggle_container,
            self._container,
            self._state_monitor,
        ]

        self._link_children()
github power-system-simulation-toolbox / psst / psst / case / generator.py View on Github external
'initial_real_power',
        'initial_reactive_power',
    )
    def _less_than_maximum_real_power_check(self, proposal):
        if not proposal['value'] <= self.maximum_real_power:
            raise t.TraitError(
                '{class_name}().{trait_name} must be a less than or equal to {class_name}().maximum_real_power.'.format(
                    class_name=proposal['owner'].__class__.__name__,
                    trait_name=proposal['trait'].name
                )
            )
        else:
            return proposal['value']


class GeneratorView(ipyw.Box):

    model = t.Instance(Generator)

    def __init__(self, model=None, *args, **kwargs):

        if model is not None:
            self.model = model
        else:
            self.model = Generator()

        super(GeneratorView, self).__init__(*args, **kwargs)

        self._title = ipyw.HTML('Generator:')

        self._name = ipyw.Text(
            value='GenCo0',