本文整理汇总了Python中fife.extensions.pychan.widgets.Icon.max_size方法的典型用法代码示例。如果您正苦于以下问题:Python Icon.max_size方法的具体用法?Python Icon.max_size怎么用?Python Icon.max_size使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类fife.extensions.pychan.widgets.Icon
的用法示例。
在下文中一共展示了Icon.max_size方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _draw
# 需要导入模块: from fife.extensions.pychan.widgets import Icon [as 别名]
# 或者: from fife.extensions.pychan.widgets.Icon import max_size [as 别名]
def _draw(self):
"""Draws the icon + bar."""
# hash buttons by creation function call
# NOTE: there may be problems with multiple buttons with the same
# images and helptext at the same time
create_btn = Callback(ImageButton, path=self.path, helptext=self.helptext)
self.button = None
if self.uncached:
self.button = create_btn()
else:
self.button = self.__widget_cache.get(create_btn, None)
if self.button is None: # create button
self.__widget_cache[create_btn] = self.button = create_btn()
else: # disconnect button from earlier layout
if self.button.parent:
self.button.parent.removeChild(self.button)
# can't cache the other instances, because we need multiple instances
# with the same data active at the same time
self.label = Label(text=self.text)
self.label.position = self.text_position
self.fill_bar = Icon(image="content/gui/images/tabwidget/green_line.png")
fill_level = (self.button.height * self.filled) // 100
self.fill_bar.size = ((2 * self.fill_bar.size[0]) // 3, fill_level)
# move fillbar down after resizing, since its origin is top aligned
self.fill_bar.position = (self.button.width, self.button.height - fill_level)
self.addChildren(self.button, self.fill_bar, self.label)
if self.marker > 0:
marker_icon = Icon(image="content/gui/icons/templates/production/marker.png")
marker_level = (self.button.height * self.marker) // 100
marker_icon.position = (self.button.width - 1, self.button.height - marker_level)
marker_icon.max_size = (5, 1)
self.addChild(marker_icon)