本文整理汇总了Python中Components.Label.Label.applySkin方法的典型用法代码示例。如果您正苦于以下问题:Python Label.applySkin方法的具体用法?Python Label.applySkin怎么用?Python Label.applySkin使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Components.Label.Label
的用法示例。
在下文中一共展示了Label.applySkin方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: applySkin
# 需要导入模块: from Components.Label import Label [as 别名]
# 或者: from Components.Label.Label import applySkin [as 别名]
def applySkin(self, desktop, parent):
# testInstance = self.GUI_WIDGET(parent)
testInstance = self.testInstance
testInstance.hide()
testSkinAttributes = []
if self.skinAttributes:
for (attrib, value) in self.skinAttributes:
if attrib == 'size':
x, y = value.split(',')
x = '2000'
new_value = x + ',' + y
testSkinAttributes.append((attrib, new_value))
else:
testSkinAttributes.append((attrib, value))
skin.applyAllAttributes(testInstance, desktop, testSkinAttributes, parent.scale)
Label.applySkin(self, desktop, parent)
maxWidth = self.instance.size().width()
# some random text
text = 'DSADJASNKDNSJANDJKSANDJKSANDNASJKNDSJKANDJKSANDJKAS'
text += 'FDSFDSFDSFDSFDSFDSFDSFDSFDSFDSFDSFDSFDSFDSFSDFDSFDS'
text += 'FDSFDSFDSFDSFDSFDSFDSFDSFDSFDSFDSFDSFDSFDSFSDFDSFDS'
text += 'FDSFDSFDSFDSFDSFDSFDSFDSFDSFDSFDSFDSFDSFDSFSDFDSFDS'
testInstance.setText(text)
actWidth = testInstance.calculateSize().width()
pixsPerChar = float(actWidth) / float(len(text))
print actWidth, '/', len(text), '=', pixsPerChar
print maxWidth
if pixsPerChar > 0:
self.maxChars = int(maxWidth / pixsPerChar)
print self.maxChars
示例2: applySkin
# 需要导入模块: from Components.Label import Label [as 别名]
# 或者: from Components.Label.Label import applySkin [as 别名]
def applySkin(self, desktop, screen):
if self.skinAttributes is not None:
attribs = []
append = attribs.append
for attrib, value in self.skinAttributes:
if attrib == "displayLength":
self.displayLength = int(value)
else:
append((attrib, value))
self.skinAttributes = attribs
return Label.applySkin(self, desktop, screen)