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


Python ipywidgets.FloatProgress方法代码示例

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


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

示例1: progress_iterator

# 需要导入模块: import ipywidgets [as 别名]
# 或者: from ipywidgets import FloatProgress [as 别名]
def progress_iterator(orig_iterator, description):
    """Wrap an iterator so that a progress bar is displayed

    Parameters
    ----------
    orig_iterator: iterator
        The original iterator. It must implement the __len__ operation so that
        its length can be calculated in advance.
    description: string
        Description will give a text label for the bar.
    """
    progress_widget = FloatProgress(min=0, max=len(orig_iterator)-1)
    widget = HBox([Label(description), progress_widget])
    display(widget)
    for count, val in enumerate(orig_iterator):
        yield val
        progress_widget.value = count 
开发者ID:DavidPowell,项目名称:OpenModes,代码行数:19,代码来源:ipython.py

示例2: init_ui_progress

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

示例3: reset

# 需要导入模块: import ipywidgets [as 别名]
# 或者: from ipywidgets import FloatProgress [as 别名]
def reset(self):
        from ipywidgets import FloatProgress, HBox, Label, Layout
        from IPython.display import display
        super(JupyterProgressRecorder, self).reset()
        self.progress_bar = FloatProgress(min=0, max=100, description='Running:')
        self.label = Label("", layout=Layout(width='100%'))
        self.box = HBox([self.progress_bar, self.label])
        display(self.box) 
开发者ID:pywr,项目名称:pywr,代码行数:10,代码来源:progress.py

示例4: __init__

# 需要导入模块: import ipywidgets [as 别名]
# 或者: from ipywidgets import FloatProgress [as 别名]
def __init__(self, total):
        super(ProgressBarJupyter, self).__init__()
        from ipywidgets import FloatProgress
        from IPython.display import display

        self.progress = FloatProgress(min=0, max=total)
        display(self.progress) 
开发者ID:dpressel,项目名称:mead-baseline,代码行数:9,代码来源:progress.py

示例5: _setup

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

        # Setup the widget, which is a bar between 0 and 100

        self._bar = FloatProgress(min=0, max=100)

        # Set explicitly the bar to 0

        self._bar.value = 0

        # Setup also an HTML label (which will contain the progress, the elapsed time and the foreseen
        # completion time)

        self._title_cell = HTML()

        if self._title is not None:

            self._title_cell.value = "%s : " % self._title

        self._label = HTML()
        self._vbox = VBox(children=[self._title_cell, self._label, self._bar])

        # Display everything

        display(self._vbox)

        self._animate(0) 
开发者ID:threeML,项目名称:threeML,代码行数:29,代码来源:progress_bar.py

示例6: __init__

# 需要导入模块: import ipywidgets [as 别名]
# 或者: from ipywidgets import FloatProgress [as 别名]
def __init__(self, a_pid):
        """通过进程pid初始化ui组件"""
        self.progress_widget = FloatProgress(value=0, min=0, max=100)
        self.text_widget = Text('pid={} begin work'.format(a_pid))
        # 通过box容器都放到一个里面
        self.progress_box = Box([self.text_widget, self.progress_widget])
        display(self.progress_box) 
开发者ID:bbfamily,项目名称:abu,代码行数:9,代码来源:ABuProgress.py

示例7: show

# 需要导入模块: import ipywidgets [as 别名]
# 或者: from ipywidgets import FloatProgress [as 别名]
def show(self, a_progress=None, ext='', p_format="{}:{}:{}%"):
        """
        进行进度控制显示主方法
        :param ext: 可以添加额外的显示文字,str,默认空字符串
        :param a_progress: 默认None, 即使用类内部计算的迭代次数进行进度显示
        :param p_format: 进度显示格式,默认{}: {}%,即'self._label:round(self._progress / self._total * 100, 2))%'
        """
        self.progress = a_progress if a_progress is not None else self.progress + 1
        ps = round(self._progress / self._total * 100, 2)

        if self._label is not None:
            # 如果初始化label没有就只显示ui进度
            self.f.write('\r')
            self.f.write(p_format.format(self._label, ext, ps))

        if ABuEnv.g_is_ipython:
            if self.progress_widget is None:
                self.progress_widget = FloatProgress(value=0, min=0, max=100)
                display(self.progress_widget)
            self.progress_widget.value = ps

        # 这样会出现余数结束的情况,还是尽量使用上下文管理器控制结束
        if self._progress == self._total:
            self.f.write('\r')
            if self.progress_widget is not None:
                self.progress_widget.close() 
开发者ID:bbfamily,项目名称:abu,代码行数:28,代码来源:ABuProgress.py


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