本文整理汇总了Python中widgets.Control.layout方法的典型用法代码示例。如果您正苦于以下问题:Python Control.layout方法的具体用法?Python Control.layout怎么用?Python Control.layout使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类widgets.Control
的用法示例。
在下文中一共展示了Control.layout方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: layout
# 需要导入模块: from widgets import Control [as 别名]
# 或者: from widgets.Control import layout [as 别名]
def layout(self, x, y):
Control.layout(self, x, y)
self.field.update(x, y, self.width, self.height)
x, y, width, height = self.field.get_content_region()
font = self.label.document.get_font()
height = font.ascent - font.descent
self.label.x = x
self.label.y = y - font.descent
示例2: layout
# 需要导入模块: from widgets import Control [as 别名]
# 或者: from widgets.Control import layout [as 别名]
def layout(self, x, y):
"""
Places the Button.
@param x X coordinate of lower left corner
@param y Y coordinate of lower left corner
"""
Control.layout(self, x, y)
self.button.update(self.x, self.y, self.width, self.height)
if self.highlight is not None:
self.highlight.update(self.x, self.y, self.width, self.height)
x, y, width, height = self.button.get_content_region()
font = self.label.document.get_font()
self.label.x = x + width/2 - self.label.content_width/2
self.label.y = y + height/2 - font.ascent/2 - font.descent
示例3: layout
# 需要导入模块: from widgets import Control [as 别名]
# 或者: from widgets.Control import layout [as 别名]
def layout(self, x, y):
"""
Places the Checkbox.
@param x X coordinate of lower left corner
@param y Y coordinate of lower left corner
"""
Control.layout(self, x, y)
if self.align == HALIGN_RIGHT: # label goes on right
self.checkbox.update(x, y + self.height/2 - self.checkbox.height/2,
self.checkbox.width, self.checkbox.height)
self.label.x = x + self.checkbox.width + self.padding
else: # label goes on left
self.label.x = x
self.checkbox.update(x + self.label.content_width + self.padding,
y + self.height/2 - self.checkbox.height/2,
self.checkbox.width, self.checkbox.height)
if self.highlight is not None:
self.highlight.update(self.x, self.y, self.width, self.height)
font = self.label.document.get_font()
height = font.ascent - font.descent
self.label.y = y + self.height/2 - height/2 - font.descent