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


Python ipywidgets.Text方法代码示例

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


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

示例1: test_priority

# 需要导入模块: import ipywidgets [as 别名]
# 或者: from ipywidgets import Text [as 别名]
def test_priority():
    @annotate(annotate='annotate', kwarg='annotate')
    def f(kwarg='default', annotate='default', default='default'):
        pass

    c = interactive(f, kwarg='kwarg')
    check_widgets(c,
        kwarg=dict(
            cls=widgets.Text,
            value='kwarg',
        ),
        annotate=dict(
            cls=widgets.Text,
            value='annotate',
        ),
    ) 
开发者ID:luckystarufo,项目名称:pySINDy,代码行数:18,代码来源:test_interaction.py

示例2: test_call_decorated_kwargs_on_trait_change

# 需要导入模块: import ipywidgets [as 别名]
# 或者: from ipywidgets import Text [as 别名]
def test_call_decorated_kwargs_on_trait_change():
    """test calling @interact(foo=bar) decorated functions"""
    d = {}
    with patch.object(interaction, 'display', record_display):
        @interact(a='kwarg')
        def foo(a='default'):
            d['a'] = a
            return a
    nt.assert_equal(len(displayed), 1)
    w = displayed[0].children[0]
    check_widget(w,
        cls=widgets.Text,
        value='kwarg',
    )
    # test calling the function directly
    a = foo('hello')
    nt.assert_equal(a, 'hello')
    nt.assert_equal(d['a'], 'hello')

    # test that setting trait values calls the function
    with patch.object(interaction, 'display', record_display):
        w.value = 'called'
    nt.assert_equal(d['a'], 'called')
    nt.assert_equal(len(displayed), 2)
    nt.assert_equal(w.value, displayed[-1]) 
开发者ID:luckystarufo,项目名称:pySINDy,代码行数:27,代码来源:test_interaction.py

示例3: __init__

# 需要导入模块: import ipywidgets [as 别名]
# 或者: from ipywidgets import Text [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

示例4: init_ui_progress

# 需要导入模块: import ipywidgets [as 别名]
# 或者: from ipywidgets import Text [as 别名]
def init_ui_progress(self):
        """初始化ui进度条"""
        if not self.show_progress:
            return

        if not ABuEnv.g_is_ipython or self._total < 2:
            return

        if ABuEnv.g_main_pid == os.getpid():
            # 如果是在主进程下显示那就直接来
            self.progress_widget = FloatProgress(value=0, min=0, max=100)
            self.text_widget = Text('pid={} begin work'.format(os.getpid()))
            self.progress_box = Box([self.text_widget, self.progress_widget])
            display(self.progress_box)
        else:
            if g_show_ui_progress and g_socket_fn is not None:
                # 子进程下通过socket通信将pid给到主进程,主进程创建ui进度条
                ABuOsUtil.socket_send_msg(g_socket_fn, '{}|init'.format(os.getpid()))

    # 不管ui进度条有什么问题,也不能影响任务工作的进度执行,反正有文字进度会始终显示 
开发者ID:bbfamily,项目名称:abu,代码行数:22,代码来源:ABuProgress.py

示例5: make_sub_tab_widget

# 需要导入模块: import ipywidgets [as 别名]
# 或者: from ipywidgets import Text [as 别名]
def make_sub_tab_widget(self, stock_info, sub_dict):
        """用于构建:股本/港股股本/机构持股子tab,市盈率/市净率/市销率子tab, 总市值/每股净资产/流通股本子tab"""
        sub_widget_array = []
        sub_widget_table_name = []
        for sc in sub_dict:
            if sc in stock_info.columns:
                sub_name = to_unicode(sub_dict[sc])
                sub_widget = widgets.Text(
                    value=to_unicode(stock_info[sc].values[0]),
                    description=sub_name,
                    disabled=False
                )
                sub_widget_array.append(sub_widget)
                sub_widget_table_name.append(sub_name)

        sub_widget_tab = widgets.Tab()
        sub_widget_tab.children = sub_widget_array
        for ind, name in enumerate(sub_widget_table_name):
            sub_widget_tab.set_title(ind, name)
        return sub_widget_tab 
开发者ID:bbfamily,项目名称:abu,代码行数:22,代码来源:ABuWGStockInfo.py

示例6: __init__

# 需要导入模块: import ipywidgets [as 别名]
# 或者: from ipywidgets import Text [as 别名]
def __init__(self,visuals,connection,**kwargs):
        ViewerBase.__init__(self,visuals,connection,**kwargs)

        width = self.getOpt("width","98%")
        height = self.getOpt("height","200px")

        self._max = self.getOpt("max",50);

        self._bg = self.getOpt("bg","#f8f8f8")
        self._border = self.getOpt("border","1px solid #d8d8d8")

        components = []
        self._log = widgets.HTML(value="",layout=widgets.Layout(width=width,height=height,border=self._border,overflow="auto"))
        components.append(self._log)

        self._filter = self.getOpt("filter")
        self._regex = None

        if self._filter != None:
            self._filterText = widgets.Text(description="Filter",value=self._filter,layout=widgets.Layout(width="70%"))
            if len(self._filter) > 0:
                self._regex = re.compile(self._filter,re.I)
            setButton = widgets.Button(description="Set")
            clearButton = widgets.Button(description="Clear")
            setButton.on_click(self.filter)
            clearButton.on_click(self.clearFilter)
            components.append(widgets.HBox([self._filterText,setButton,clearButton]))

        self._box = widgets.VBox(components,layout=widgets.Layout(width="100%"))

        s = ""
        s += "<div style='width:100%;height:100%;background:" + self._bg + "'>"
        s += "</div>"
        self._log.value = s

        self._messages = []

        self._connection.getLog().addDelegate(self)
        
        self.children = [self._box] 
开发者ID:sassoftware,项目名称:python-esppy,代码行数:42,代码来源:viewers.py

示例7: _create_widget

# 需要导入模块: import ipywidgets [as 别名]
# 或者: from ipywidgets import Text [as 别名]
def _create_widget(self):
        if self.multiline:
            return Textarea(layout=self.layout, disabled=self.disabled)
        return Text(layout=self.layout, disabled=self.disabled) 
开发者ID:ideonate,项目名称:jupyter-innotater,代码行数:6,代码来源:data.py

示例8: create_widgets

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

        Returns:

        """
        select = widgets.Select  # Multiple
        self.w_group = select(description="Groups:")
        self.w_node = select(description="Nodes:")
        self.w_file = select(description="Files:")
        self.w_text = widgets.HTML()
        # self.w_text = widgets.Textarea()
        self.w_text.layout.height = "330px"
        self.w_text.layout.width = "580px"
        self.w_text.disabled = True
        #         self.w_plot = self.fig
        w_list = widgets.VBox([self.w_group, self.w_node, self.w_file])
        self.w_tab = widgets.HBox([w_list, self.w_text])
        #         tab = widgets.Tab(children=[self.w_group, self.w_node, self.w_file, self.w_text])
        #         [tab.set_title(num, name) for num, name in enumerate(['groups', 'nodes', 'files', 'text'])]
        #         self.w_tab = tab

        self.w_path = widgets.Text(name="Path: ")
        self.w_path.layout.width = "680px"
        self.w_type = widgets.Text(name="Type: ")

        self.refresh_view() 
开发者ID:pyiron,项目名称:pyiron,代码行数:29,代码来源:gui.py

示例9: resistances_image

# 需要导入模块: import ipywidgets [as 别名]
# 或者: from ipywidgets import Text [as 别名]
def resistances_image(self):
        '''Widgets for resistance model selection'''

        self.w_res = widgets.ToggleButtons(
            description='Select TSEB model to run:',
            options={
                'Kustas & Norman 1999': 0,
                'Choudhury & Monteith 1988': 1,
                'McNaughton & Van der Hurk': 2},
            value=self.res,
            width=300)

        self.w_PT_But = widgets.Button(
            description='Browse Initial alphaPT Image')
        self.w_PT = widgets.Text(description=' ', value=str(self.max_PT), width=500)

        self.w_KN_b_But = widgets.Button(description='Browse Resistance Parameter b Image')
        self.w_KN_b = widgets.Text(
            value=str(self.KN_b), description=' ', width=500)
        self.w_KN_c_But = widgets.Button(description=('Browse Resistance Parameter c image'))
        self.w_KN_c = widgets.Text(
            value=str(self.KN_c), description='(m s-1 K-1/3)', width=500)
        self.w_KN_C_dash_But = widgets.Button(description=("Browse Resistance Parameter C' Image"))
        self.w_KN_C_dash = widgets.Text(
            value=str(self.KN_C_dash), description="s1/2 m-1", width=500)
        self.KN_params_box = widgets.VBox([widgets.HTML('Select resistance parameter b image or type a constant value'),
                                           widgets.HBox([self.w_KN_b_But, self.w_KN_b]),
                                           widgets.HTML('Select resistance parameter c image or type a constant value'),
                                           widgets.HBox([self.w_KN_c_But, self.w_KN_c]),
                                           widgets.HTML('Select resistance parameter C\' image or type a constant value'),
                                           widgets.HBox([self.w_KN_C_dash_But, self.w_KN_C_dash])], background_color='#EEE')
        self.res_page = widgets.VBox([self.w_res, self.KN_params_box], background_color='#EEE')

        self.w_KN_b_But.on_click(
            lambda b: self._on_input_clicked(b, 'Resistance Parameter b', self.w_KN_b))
        self.w_KN_c_But.on_click(
            lambda b: self._on_input_clicked(b, 'Resistance Parameter c', self.w_KN_c))
        self.w_KN_C_dash_But.on_click(
            lambda b: self._on_input_clicked(b, 'Resistance Parameter C\'', self.w_KN_C_dash)) 
开发者ID:hectornieto,项目名称:pyTSEB,代码行数:41,代码来源:TSEBIPythonInterface.py

示例10: test_single_value_string

# 需要导入模块: import ipywidgets [as 别名]
# 或者: from ipywidgets import Text [as 别名]
def test_single_value_string():
    a = u'hello'
    c = interactive(f, a=a)
    w = c.children[0]
    check_widget(w,
        cls=widgets.Text,
        description='a',
        value=a,
    ) 
开发者ID:luckystarufo,项目名称:pySINDy,代码行数:11,代码来源:test_interaction.py

示例11: test_decorator_no_call

# 需要导入模块: import ipywidgets [as 别名]
# 或者: from ipywidgets import Text [as 别名]
def test_decorator_no_call():
    with patch.object(interaction, 'display', record_display):
        @interact
        def foo(a='default'):
            pass
    nt.assert_equal(len(displayed), 1)
    w = displayed[0].children[0]
    check_widget(w,
        cls=widgets.Text,
        value='default',
    ) 
开发者ID:luckystarufo,项目名称:pySINDy,代码行数:13,代码来源:test_interaction.py

示例12: test_call_interact

# 需要导入模块: import ipywidgets [as 别名]
# 或者: from ipywidgets import Text [as 别名]
def test_call_interact():
    def foo(a='default'):
        pass
    with patch.object(interaction, 'display', record_display):
        ifoo = interact(foo)
    nt.assert_equal(len(displayed), 1)
    w = displayed[0].children[0]
    check_widget(w,
        cls=widgets.Text,
        value='default',
    ) 
开发者ID:luckystarufo,项目名称:pySINDy,代码行数:13,代码来源:test_interaction.py

示例13: test_call_interact_on_trait_changed_none_return

# 需要导入模块: import ipywidgets [as 别名]
# 或者: from ipywidgets import Text [as 别名]
def test_call_interact_on_trait_changed_none_return():
    def foo(a='default'):
        pass
    with patch.object(interaction, 'display', record_display):
        ifoo = interact(foo)
    nt.assert_equal(len(displayed), 1)
    w = displayed[0].children[0]
    check_widget(w,
        cls=widgets.Text,
        value='default',
    )
    with patch.object(interaction, 'display', record_display):
        w.value = 'called'
    nt.assert_equal(len(displayed), 1) 
开发者ID:luckystarufo,项目名称:pySINDy,代码行数:16,代码来源:test_interaction.py

示例14: test_fixed

# 需要导入模块: import ipywidgets [as 别名]
# 或者: from ipywidgets import Text [as 别名]
def test_fixed():
    c = interactive(f, a=widgets.fixed(5), b='text')
    nt.assert_equal(len(c.children), 2)
    w = c.children[0]
    check_widget(w,
        cls=widgets.Text,
        value='text',
        description='b',
    ) 
开发者ID:luckystarufo,项目名称:pySINDy,代码行数:11,代码来源:test_interaction.py

示例15: test_default_description

# 需要导入模块: import ipywidgets [as 别名]
# 或者: from ipywidgets import Text [as 别名]
def test_default_description():
    c = interactive(f, b='text')
    w = c.children[0]
    check_widget(w,
        cls=widgets.Text,
        value='text',
        description='b',
    ) 
开发者ID:luckystarufo,项目名称:pySINDy,代码行数:10,代码来源:test_interaction.py


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