當前位置: 首頁>>代碼示例>>Python>>正文


Python Widget.size方法代碼示例

本文整理匯總了Python中widgets.Widget.size方法的典型用法代碼示例。如果您正苦於以下問題:Python Widget.size方法的具體用法?Python Widget.size怎麽用?Python Widget.size使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在widgets.Widget的用法示例。


在下文中一共展示了Widget.size方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: size

# 需要導入模塊: from widgets import Widget [as 別名]
# 或者: from widgets.Widget import size [as 別名]
    def size(self, dialog):
        """
        Recalculate the size of the Scrollable.

        @param dialog Dialog which contains us
        """
        if dialog is None:
            return
        Widget.size(self, dialog)
        if self.is_fixed_size:
            self.width, self.height = self.max_width, self.max_height

        self.hscrollbar_height = dialog.theme["hscrollbar"]["left"]["image"].height
        self.vscrollbar_width = dialog.theme["vscrollbar"]["up"]["image"].width

        if self.root_group is None:  # do we need to re-clone dialog groups?
            self.theme = dialog.theme
            self.batch = dialog.batch
            self.root_group = ScrollableGroup(0, 0, self.width, self.height, parent=dialog.fg_group)
            self.panel_group = pyglet.graphics.OrderedGroup(0, self.root_group)
            self.bg_group = pyglet.graphics.OrderedGroup(1, self.root_group)
            self.fg_group = pyglet.graphics.OrderedGroup(2, self.root_group)
            self.highlight_group = pyglet.graphics.OrderedGroup(3, self.root_group)
            Wrapper.delete(self)  # force children to abandon old groups

        Wrapper.size(self, self)  # all children are to use our groups

        if self.always_show_scrollbars or (self.max_width and self.width > self.max_width):
            if self.hscrollbar is None:
                self.hscrollbar = HScrollbar(self.max_width)
        else:
            if self.hscrollbar is not None:
                self.hscrollbar.delete()
                self.hscrollbar = None

        if self.always_show_scrollbars or (self.max_height and self.height > self.max_height):
            if self.vscrollbar is None:
                self.vscrollbar = VScrollbar(self.max_height)
        else:
            if self.vscrollbar is not None:
                self.vscrollbar.delete()
                self.vscrollbar = None

        self.width = min(self.max_width or self.width, self.width)
        self.content_width = self.width
        self.height = min(self.max_height or self.height, self.height)
        self.content_height = self.height

        if self.hscrollbar is not None:
            self.hscrollbar.size(dialog)
            self.hscrollbar.set(self.max_width, max(self.content.width, self.max_width))
            self.height += self.hscrollbar.height

        if self.vscrollbar is not None:
            self.vscrollbar.size(dialog)
            self.vscrollbar.set(self.max_height, max(self.content.height, self.max_height))
            self.width += self.vscrollbar.width
開發者ID:swindy,項目名稱:sy-game,代碼行數:59,代碼來源:scrollable.py

示例2: size

# 需要導入模塊: from widgets import Widget [as 別名]
# 或者: from widgets.Widget import size [as 別名]
    def size(self, dialog):
        """
        The default Wrapper wraps up its Widget snugly.

        @param dialog The Dialog which contains the Wrapper
        """
        if dialog is None:
            return
        Widget.size(self, dialog)
        if self.content is not None:
            self.content.size(dialog)
            self.width, self.height = self.content.width, self.content.height
        else:
            self.width = self.height = 0
開發者ID:chrisbiggar,項目名稱:shiny-light,代碼行數:16,代碼來源:frame.py

示例3: size

# 需要導入模塊: from widgets import Widget [as 別名]
# 或者: from widgets.Widget import size [as 別名]
    def size(self, dialog):
        """
        Calculates size of the layout, based on its children.

        @param dialog The Dialog which contains the layout
        """
        if dialog is None:
            return
        Widget.size(self, dialog)
        height = 0
        if len(self.content) < 2:
            width = 0
        else:
            width = -self.padding
        for item in self.content:
            item.size(dialog)
            height = max(height, item.height)
            width += item.width + self.padding
        self.width, self.height = width, height
        self.expandable = [x for x in self.content if x.is_expandable()]
開發者ID:chrisbiggar,項目名稱:shiny-light,代碼行數:22,代碼來源:layout.py


注:本文中的widgets.Widget.size方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。