本文整理汇总了Python中qtpy.QtWidgets.QLabel.__init__方法的典型用法代码示例。如果您正苦于以下问题:Python QLabel.__init__方法的具体用法?Python QLabel.__init__怎么用?Python QLabel.__init__使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类qtpy.QtWidgets.QLabel
的用法示例。
在下文中一共展示了QLabel.__init__方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from qtpy.QtWidgets import QLabel [as 别名]
# 或者: from qtpy.QtWidgets.QLabel import __init__ [as 别名]
def __init__(self, parent=None, init_channel=None):
QLabel.__init__(self, parent)
PyDMWidget.__init__(self, init_channel=init_channel)
if 'Text' not in PyDMLabel.RULE_PROPERTIES:
PyDMLabel.RULE_PROPERTIES = PyDMWidget.RULE_PROPERTIES.copy()
PyDMLabel.RULE_PROPERTIES.update(
{'Text': ['value_changed', str]})
self.app = QApplication.instance()
self.setTextFormat(Qt.PlainText)
self.setTextInteractionFlags(Qt.NoTextInteraction)
self.setText("PyDMLabel")
self._display_format_type = self.DisplayFormat.Default
self._string_encoding = "utf_8"
if is_pydm_app():
self._string_encoding = self.app.get_string_encoding()
示例2: __init__
# 需要导入模块: from qtpy.QtWidgets import QLabel [as 别名]
# 或者: from qtpy.QtWidgets.QLabel import __init__ [as 别名]
def __init__(self, parent, arr):
QLabel.__init__(self)
# we need to hold a reference to
# arr because QImage doesn't copy the data
# and the buffer must be alive as long
# as the image is alive.
self.arr = arr
# we also need to pass in the row-stride to
# the constructor, because we can't guarantee
# that every row of the numpy data is
# 4-byte aligned. Which Qt would require
# if we didn't pass the stride.
self.img = QImage(arr.data, arr.shape[1], arr.shape[0],
arr.strides[0], QImage.Format_RGB888)
self.pm = QPixmap.fromImage(self.img)
self.setPixmap(self.pm)
self.setAlignment(QtCore.Qt.AlignTop)
self.setMinimumSize(100, 100)