当前位置: 首页>>代码示例>>Python>>正文


Python QLabel.__init__方法代码示例

本文整理汇总了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()
开发者ID:slaclab,项目名称:pydm,代码行数:17,代码来源:label.py

示例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)
开发者ID:TheArindham,项目名称:scikit-image,代码行数:22,代码来源:qt_plugin.py


注:本文中的qtpy.QtWidgets.QLabel.__init__方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。