本文整理汇总了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
示例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)