当前位置: 首页>>代码示例>>Python>>正文


Python ipywidgets.Layout方法代码示例

本文整理汇总了Python中ipywidgets.Layout方法的典型用法代码示例。如果您正苦于以下问题:Python ipywidgets.Layout方法的具体用法?Python ipywidgets.Layout怎么用?Python ipywidgets.Layout使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ipywidgets的用法示例。


在下文中一共展示了ipywidgets.Layout方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: setDimensions

# 需要导入模块: import ipywidgets [as 别名]
# 或者: from ipywidgets import Layout [as 别名]
def setDimensions(self, width=None, height=None):
        """ Set the dimensions for the map """
        def check(value, t):
            if value is None: return value
            if isinstance(value, (int, float)):
                return '{}px'.format(value)
            elif isinstance(value, (str,)):
                search = re.search('(\d+)', value).groups()
                intvalue = search[0]
                splitted = value.split(intvalue)
                units = splitted[1]
                if units == '%':
                    if t == 'width': return '{}%'.format(intvalue)
                    else: return None
                else:
                    return '{}px'.format(intvalue)
            else:
                msg = 'parameter {} of setDimensions must be int or str'
                raise ValueError(msg.format(t))
        self.layout = Layout(width=check(width, 'width'),
                             height=check(height, 'height')) 
开发者ID:fitoprincipe,项目名称:ipygee,代码行数:23,代码来源:map.py

示例2: make_labels

# 需要导入模块: import ipywidgets [as 别名]
# 或者: from ipywidgets import Layout [as 别名]
def make_labels():
    """Makes the labels widget.

    Returns:
        widget: The labels widget.
    """
    labels0 = widgets.HTML(value="<h5>Job ID</h5>",
                           layout=widgets.Layout(width='190px'))
    labels1 = widgets.HTML(value='<h5>Backend</h5>',
                           layout=widgets.Layout(width='145px'))
    labels2 = widgets.HTML(value='<h5>Status</h5>',
                           layout=widgets.Layout(width='95px'))
    labels3 = widgets.HTML(value='<h5>Queue</h5>',
                           layout=widgets.Layout(width='70px'))
    labels4 = widgets.HTML(value='<h5>Message</h5>')

    labels = widgets.HBox(children=[labels0, labels1, labels2, labels3, labels4],
                          layout=widgets.Layout(width='600px',
                                                margin='0px 0px 0px 37px'))
    return labels 
开发者ID:Qiskit,项目名称:qiskit-terra,代码行数:22,代码来源:job_widgets.py

示例3: circuit_diagram_widget

# 需要导入模块: import ipywidgets [as 别名]
# 或者: from ipywidgets import Layout [as 别名]
def circuit_diagram_widget() -> wid.Box:
    """Create a circuit diagram widget.

    Returns:
        Output widget.
    """
    # The max circuit height corresponds to a 20Q circuit with flat
    # classical register.
    top_out = wid.Output(layout=wid.Layout(width='100%',
                                           height='auto',
                                           max_height='1000px',
                                           overflow='hidden scroll',))

    top = wid.Box(children=[top_out], layout=wid.Layout(width='100%', height='auto'))

    return top 
开发者ID:Qiskit,项目名称:qiskit-terra,代码行数:18,代码来源:library.py

示例4: plot

# 需要导入模块: import ipywidgets [as 别名]
# 或者: from ipywidgets import Layout [as 别名]
def plot(self, show_quadrature = "", x_unit = "ns"): 
        """
        Plots the sequences stored in channel.
        A slider provides the option to sweep through different time values.
        Readout pulse is fixed at t = 0, where is t>0 before the readout tone.

        Args:
            x_unit: unit of the x-axis in the plot. Options are "s", "ms", "us", "ns".
        """
        show_iq = False
        if show_quadrature in ["I", "Q"]:
            show_iq = True
        sequences, readout_indices = self._get_sequences(IQ_mixing=show_iq)
        seq_max = len(readout_indices) - 1
        if show_quadrature is "I":
            sequences = [np.real(seq) for seq in sequences]
        elif show_quadrature is "Q":
            sequences = [np.imag(seq) for seq in sequences]
        
        bounds = self._get_boundaries(sequences, readout_indices, x_unit)
        
        interact(lambda sequence: self._plot_sequence(sequences[sequence], readout_indices[sequence], x_unit, bounds), 
                sequence = widgets.IntSlider(value = 0, min = 0, max = seq_max, layout = Layout(width = "98%", height = "50px")))
        return True 
开发者ID:qkitgroup,项目名称:qkit,代码行数:26,代码来源:VirtualAWG.py

示例5: _interact_frequency

# 需要导入模块: import ipywidgets [as 别名]
# 或者: from ipywidgets import Layout [as 别名]
def _interact_frequency(self,freq_val,min_freq=87.5,max_freq=108,freq_step=0.2):
        '''
        Sets up tuning frequency slider widget for Mono FM Example
        '''
        self.slider = FloatSlider(
            value=freq_val,
            min=min_freq,
            max=max_freq,
            step=freq_step,
            description=r'$f_c\;$',
            continuous_update=False,
            orientation='horizontal',
            readout_format='0.1f',
            layout=Layout(
                width='90%',
            ) 
        )
        self.slider.style.handle_color = 'lightblue'

        self.center_freq_widget = interactive(self.set_fc_mhz, fc = self.slider)
        display(self.center_freq_widget) 
开发者ID:mwickert,项目名称:scikit-dsp-comm,代码行数:23,代码来源:rtlsdr_helper.py

示例6: _interact_audio_gain

# 需要导入模块: import ipywidgets [as 别名]
# 或者: from ipywidgets import Layout [as 别名]
def _interact_audio_gain(self,gain_val=0,min_gain=-60,max_gain=6,gain_step=0.1):
        '''
        Sets up audio gain slider widget for Mono FM Example
        '''
        self.gain_slider = FloatSlider(
            value=gain_val,
            min=min_gain,
            max=max_gain,
            step=gain_step,
            description='Gain (dB)',
            continuous_update=True,
            orientation='horizontal',
            readout_format='0.1f',
            layout=Layout(
                width='90%',
            )
        )
        self.gain_slider.style.handle_color = 'lightgreen'

        self.audio_gain_widget = interactive(self.set_audio_gain_db,gain=self.gain_slider)
        display(self.audio_gain_widget) 
开发者ID:mwickert,项目名称:scikit-dsp-comm,代码行数:23,代码来源:rtlsdr_helper.py

示例7: make_labels

# 需要导入模块: import ipywidgets [as 别名]
# 或者: from ipywidgets import Layout [as 别名]
def make_labels() -> widgets.HBox:
    """Makes the labels widget.

    Returns:
        The labels widget.
    """
    labels0 = widgets.HTML(value="<h5>Job ID</h5>",
                           layout=widgets.Layout(width='190px'))
    labels1 = widgets.HTML(value='<h5>Backend</h5>',
                           layout=widgets.Layout(width='165px'))
    labels2 = widgets.HTML(value='<h5>Status</h5>',
                           layout=widgets.Layout(width='125px'))
    labels3 = widgets.HTML(value='<h5>Est. Start Time</h5>',
                           layout=widgets.Layout(width='100px'))

    labels = widgets.HBox(children=[labels0, labels1, labels2, labels3],
                          layout=widgets.Layout(width='700px',
                                                margin='0px 0px 0px 35px'))
    return labels 
开发者ID:Qiskit,项目名称:qiskit-ibmq-provider,代码行数:21,代码来源:job_widgets.py

示例8: _widget

# 需要导入模块: import ipywidgets [as 别名]
# 或者: from ipywidgets import Layout [as 别名]
def _widget(self):
        if not hasattr(self, "_cached_widget"):
            try:
                import ipywidgets

                children = [ipywidgets.HTML("<h2>Cluster Options</h2>")]
                children.extend([f.widget() for f in self._fields.values()])
                column = ipywidgets.Box(
                    children=children,
                    layout=ipywidgets.Layout(
                        display="flex", flex_flow="column", align_items="stretch"
                    ),
                )
                widget = ipywidgets.Box(children=[column])
            except ImportError:
                widget = None
            object.__setattr__(self, "_cached_widget", widget)
        return self._cached_widget 
开发者ID:dask,项目名称:dask-gateway,代码行数:20,代码来源:options.py

示例9: widget

# 需要导入模块: import ipywidgets [as 别名]
# 或者: from ipywidgets import Layout [as 别名]
def widget(self):
        import ipywidgets

        def handler(change):
            self.set(change.new)

        input = self._widget()
        input.observe(handler, "value")
        self._widgets.add(input)

        label = ipywidgets.HTML(
            "<p style='font-weight: bold; margin-right: 8px'>%s:</p>" % self.label
        )

        row = ipywidgets.Box(
            children=[label, input],
            layout=ipywidgets.Layout(
                display="flex", flex_flow="row wrap", justify_content="space-between"
            ),
        )

        return row 
开发者ID:dask,项目名称:dask-gateway,代码行数:24,代码来源:options.py

示例10: __init__

# 需要导入模块: import ipywidgets [as 别名]
# 或者: from ipywidgets import Layout [as 别名]
def __init__(self, pyname, getversion=False):
        self.displays = {}
        self.pyname = pyname
        self.getversion = getversion

        self.nbv_display = VBox()
        self.widgets_display = VBox()
        self.warning = ipywidgets.HTML()

        super().__init__()
        children = [ipywidgets.HTML("<h4><center>%s</center></h4>" % self.pyname,
                                    layout=ipywidgets.Layout(align_self='center')),
                    ipywidgets.HTML(self.HEADER)]

        for location in install.nbextension_ordered_paths():
            self.state = install.get_installed_versions(self.pyname, self.getversion)
            props = self._get_props(location)
            self.displays[location] = ExtensionInstallLocation(self, props)
            children.append(self.displays[location])

        children.append(self.warning)

        self.children = children
        self._highlight_active() 
开发者ID:Autodesk,项目名称:notebook-molecular-visualization,代码行数:26,代码来源:visualization.py

示例11: __init__

# 需要导入模块: import ipywidgets [as 别名]
# 或者: from ipywidgets import Layout [as 别名]
def __init__(self, image, client):
        self._err = False
        self._client = client
        self.image = image
        self.status = ipy.HTML(layout=ipy.Layout(width="20px"))
        self.html = ipy.HTML(value=image, layout=ipy.Layout(width="400px"))
        self.html.add_class('nbv-monospace')
        self.msg = ipy.HTML(layout=ipy.Layout(width='300px'))
        self.button = ipy.Button(layout=ipy.Layout(width='100px'))
        if mdt.compute.config.devmode:
            self.button.on_click(self.rebuild)
        else:
            self.button.on_click(self.pull)
        self._reactivate_button()
        self._set_status_value()
        super().__init__(children=[self.status, self.html, self.button, self.msg]) 
开发者ID:Autodesk,项目名称:notebook-molecular-visualization,代码行数:18,代码来源:images.py

示例12: __init__

# 需要导入模块: import ipywidgets [as 别名]
# 或者: from ipywidgets import Layout [as 别名]
def __init__(self, mol):
        super().__init__(mol)

        self._atomset = collections.OrderedDict()

        self.atom_listname = ipy.Label('Selected atoms:', layout=ipy.Layout(width='100%'))
        self.atom_list = ipy.SelectMultiple(options=list(self.viewer.selected_atom_indices),
                                            layout=ipy.Layout(height='150px'))
        traitlets.directional_link(
            (self.viewer, 'selected_atom_indices'),
            (self.atom_list, 'options'),
            self._atom_indices_to_atoms
        )

        self.select_all_atoms_button = ipy.Button(description='Select all atoms')
        self.select_all_atoms_button.on_click(self.select_all_atoms)

        self.select_none = ipy.Button(description='Clear all selections')
        self.select_none.on_click(self.clear_selections)

        self.representation_buttons = ipy.ToggleButtons(options=['stick','ribbon', 'auto', 'vdw'],
                                                        value='auto')
        self.representation_buttons.observe(self._change_representation, 'value') 
开发者ID:Autodesk,项目名称:notebook-molecular-visualization,代码行数:25,代码来源:selection.py

示例13: __init__

# 需要导入模块: import ipywidgets [as 别名]
# 或者: from ipywidgets import Layout [as 别名]
def __init__(self, format=None, *args, **kwargs):
        description = kwargs.pop('description', 'FloatSlider')
        min = kwargs.setdefault('min', 0.0)
        max = kwargs.setdefault('max', 10.0)
        self.formatstring = format
        self.header = ipy.HTML()
        self.readout = ipy.Text(layout=ipy.Layout(width='100px'))
        self.readout.on_submit(self.parse_value)

        kwargs.setdefault('readout', False)
        self.slider = ipy.FloatSlider(*args, **process_widget_kwargs(kwargs))
        self.minlabel = ipy.HTML(u'<font size=1.5>{}</font>'.format(self.formatstring.format(min)))
        self.maxlabel = ipy.HTML(u'<font size=1.5>{}</font>'.format(self.formatstring.format(max)))
        self.sliderbox = HBox([self.minlabel, self.slider, self.maxlabel])
        traitlets.link((self, 'description'), (self.header, 'value'))
        traitlets.link((self, 'value'), (self.slider, 'value'))
        self.description = description
        self.update_readout()
        super().__init__([self.header,
                                                  self.readout,
                                                  self.sliderbox]) 
开发者ID:Autodesk,项目名称:notebook-molecular-visualization,代码行数:23,代码来源:components.py

示例14: __init__

# 需要导入模块: import ipywidgets [as 别名]
# 或者: from ipywidgets import Layout [as 别名]
def __init__(self, value=None, units=None, **kwargs):
        kwargs.setdefault('display', 'flex')
        kwargs.setdefault('flex_flow','row wrap')
        super().__init__(layout=ipy.Layout(display='flex', flex_flow='row wrap'),
                                       **process_widget_kwargs(kwargs))
        self.textbox = ipy.Text()
        self.textbox.observe(self._validate, 'value')
        self._error_msg = None

        if units is not None:
            self.dimensionality = u.get_units(units).dimensionality
        else:
            self.dimensionality = None

        self._validated_value = None
        self.validated = ipy.HTML(self.INVALID)
        self.children = [self.textbox, self.validated]
        self._is_valid = False
        if value is not None:
            self.value = value 
开发者ID:Autodesk,项目名称:notebook-molecular-visualization,代码行数:22,代码来源:components.py

示例15: __init__

# 需要导入模块: import ipywidgets [as 别名]
# 或者: from ipywidgets import Layout [as 别名]
def __init__(self, wg_manager):
        super(WidgetPositionBase, self).__init__(wg_manager)
        self.add = widgets.Button(description=u'选定为全局资金管理策略', layout=widgets.Layout(width='98%'),
                                  button_style='info')
        # 选定全局资金管理略指令按钮
        self.add.on_click(self.add_position)
        # 运行混入的BFSubscriberMixin中ui初始化
        self.subscriber_ui([u'点击\'已添加的买入策略\'框中的买入策略', u'资金管理做为买入策略的资金管理策略'])
        # 买入策略框点击行为:将本卖出策略加到对应的买入策略做为附属
        self.buy_factors.observe(self.add_position_to_buy_factor, names='value')
        self.accordion.set_title(0, u'添加为指定买入因子的资金管理策略')
        accordion_shut(self.accordion)
        self.add_box = widgets.VBox([self.add, self.accordion])

        # 具体子策略构建
        self._init_widget() 
开发者ID:bbfamily,项目名称:abu,代码行数:18,代码来源:ABuWGPosBase.py


注:本文中的ipywidgets.Layout方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。