本文整理汇总了Python中fife.extensions.pychan.widgets.Icon.helptext方法的典型用法代码示例。如果您正苦于以下问题:Python Icon.helptext方法的具体用法?Python Icon.helptext怎么用?Python Icon.helptext使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类fife.extensions.pychan.widgets.Icon
的用法示例。
在下文中一共展示了Icon.helptext方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: create_resource_icon
# 需要导入模块: from fife.extensions.pychan.widgets import Icon [as 别名]
# 或者: from fife.extensions.pychan.widgets.Icon import helptext [as 别名]
def create_resource_icon(res_id, db):
"""Creates a pychan Icon for a resource. Helptext is set to name of *res_id*.
@param res_id: resource id
@param db: dbreader for main db"""
widget = Icon(image=get_res_icon_path(res_id))
widget.helptext = db.get_res_name(res_id)
return widget
示例2: create_resource_icon
# 需要导入模块: from fife.extensions.pychan.widgets import Icon [as 别名]
# 或者: from fife.extensions.pychan.widgets.Icon import helptext [as 别名]
def create_resource_icon(res_id, db, size=50):
"""Creates a pychan Icon for a resource. Helptext is set to name of *res_id*.
Returns None if *size* parameter is invalid (not one of 16, 24, 32, 50).
@param res_id: resource id
@param db: dbreader for main db
@param size: Size of icon in px. Valid: 16, 24, 32, 50."""
widget = None
if size in (16, 24, 32, 50):
widget = Icon(image=get_res_icon_path(res_id, size))
widget.helptext = db.get_res_name(res_id)
return widget
示例3: create_resource_icon
# 需要导入模块: from fife.extensions.pychan.widgets import Icon [as 别名]
# 或者: from fife.extensions.pychan.widgets.Icon import helptext [as 别名]
def create_resource_icon(res_id, db, size=50):
"""Creates a pychan Icon for a resource. Helptext is set to res name.
Returns None if size parameter is invalid.
@param res_id: resource id
@param db: dbreader for main db
@param size: Size of icon in px. Valid: 16, 24, 32, 50."""
from fife.extensions.pychan.widgets import Icon
widget = None
if size in (16, 24, 32, 50):
icon_path = get_res_icon_path(res_id, size)
try:
widget = Icon(image=icon_path)
except RuntimeError: # ImageManager: image not found, use placeholder
print '[WW] Image not found: {icon_path}'.format(icon_path=icon_path)
widget = Icon(image=get_res_icon_path('placeholder', size))
widget.helptext = db.get_res_name(res_id)
return widget