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


Python Progressbar.place方法代码示例

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


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

示例1: InteractionWindow

# 需要导入模块: from ttk import Progressbar [as 别名]
# 或者: from ttk.Progressbar import place [as 别名]

#.........这里部分代码省略.........
    def select_box(self, event):
        bbox = (event.x, event.y)
        self.curr_box_bbox = (self.init_box_pos, bbox)
        self.delete("boxselector")

        # Depending on the mode, we get different colors on the box
        if self.mode is "roi":
            width = self.curr_box_bbox[1][0]
            height = self.curr_box_bbox[1][1]
            topx = self.curr_box_bbox[0][0]
            topy = self.curr_box_bbox[0][1]

            l0_width, l0_height = self.transform_to_level_zero(width, height)
            l0_topx, l0_topy = self.transform_to_level_zero(topx, topy)

            # Get absolute pixel differences
            l0_width = abs(l0_width - l0_topx)
            l0_height = abs(l0_height - l0_topy)
            if (l0_width > 1000) or (l0_height > 1000):
                self.create_rectangle(self.curr_box_bbox, outline="red", tags="boxselector")
            else:
                self.create_rectangle(self.curr_box_bbox, outline="yellow", tags="boxselector")
        elif self.mode is "zoom":
            self.create_rectangle(self.curr_box_bbox, outline="green", tags="boxselector")

    # Lets us render a status bar, letting users know how far something has gotten
    def render_status_text(self, position, text, percentage, length):
        percentage = int(percentage*100.0)
        x = position[0]
        y = position[1]

        self.progress["length"] = length
        self.progress["value"] = percentage
        self.progress.place(x=x, y=y)

        self.create_text(x, y, text=text, anchor=SW, font=("Purisa", 16), tags="progresstext", fill="white")

        self.master.update()

    def clear_status_text(self):
        self.progress.place_forget()
        self.delete("progresstext")
        self.master.update()

    def set_box(self, event):
        # This is executed when the user has dragged a selection box (either zoom or ROI) and he/she has now let go of
        # the mouse. Our goal here is to get the level 0 coordinates of this box and then pass this box on depending
        # on what we want to do.
        width = self.curr_box_bbox[1][0]
        height = self.curr_box_bbox[1][1]
        topx = self.curr_box_bbox[0][0]
        topy = self.curr_box_bbox[0][1]

        l0_width, l0_height = self.transform_to_level_zero(width, height)
        l0_topx, l0_topy = self.transform_to_level_zero(topx, topy)

        # Get absolute pixel differences
        l0_width = abs(l0_width - l0_topx)
        l0_height = abs(l0_height - l0_topy)

        # We need to be able to access this region in the resize function
        self.last_selection_region = [(int(l0_topx), int(l0_topy)), (int(l0_width), int(l0_height))]

        #entire_roi = numpy.array(self.ndpi_file.read_region((int(l0_topx), int(l0_topy)), 0, (int(l0_width), int(l0_height))), dtype=numpy.uint8)
        # Multiply percentages of totals and transform to high res level
        # ------------------NEW----------------
开发者ID:tsbb11stressedblood,项目名称:stressedblood,代码行数:70,代码来源:gui.py


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