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


Python Widget.layout方法代码示例

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


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

示例1: layout

# 需要导入模块: from widgets import Widget [as 别名]
# 或者: from widgets.Widget import layout [as 别名]
    def layout(self, x, y):
        """
        Lays out the child Widgets, in order from left to right.

        @param x X coordinate of the lower left corner
        @param y Y coordinate of the lower left corner
        """
        Widget.layout(self, x, y)

        # Expand any expandable content to our height
        for item in self.content:
            if item.is_expandable() and item.height < self.height:
                item.expand(item.width, self.height)

        left = x
        if self.align == VALIGN_TOP:
            for item in self.content:
                item.layout(left, y + self.height - item.height)
                left += item.width + self.padding
        elif self.align == VALIGN_CENTER:
            for item in self.content:
                item.layout(left, y + self.height/2 - item.height/2)
                left += item.width + self.padding
        else: # VALIGN_BOTTOM
            for item in self.content:
                item.layout(left, y)
                left += item.width + self.padding
开发者ID:chrisbiggar,项目名称:shiny-light,代码行数:29,代码来源:layout.py

示例2: layout

# 需要导入模块: from widgets import Widget [as 别名]
# 或者: from widgets.Widget import layout [as 别名]
    def layout(self, x, y):
        """
        Assigns a new position to the Wrapper.

        @param x X coordinate of the Wrapper's lower left corner
        @param y Y coordinate of the Wrapper's lower left corner
        """
        Widget.layout(self, x, y)
        if self.content is not None:
            x, y = GetRelativePoint(self, self.anchor, self.content, self.anchor, self.content_offset)
            self.content.layout(x, y)
开发者ID:swindy,项目名称:sy-game,代码行数:13,代码来源:frame.py


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