當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。