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


Python QLabel.setContentsMargins方法代码示例

本文整理汇总了Python中spyderlib.qt.QtGui.QLabel.setContentsMargins方法的典型用法代码示例。如果您正苦于以下问题:Python QLabel.setContentsMargins方法的具体用法?Python QLabel.setContentsMargins怎么用?Python QLabel.setContentsMargins使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在spyderlib.qt.QtGui.QLabel的用法示例。


在下文中一共展示了QLabel.setContentsMargins方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: DependenciesDialog

# 需要导入模块: from spyderlib.qt.QtGui import QLabel [as 别名]
# 或者: from spyderlib.qt.QtGui.QLabel import setContentsMargins [as 别名]
class DependenciesDialog(QDialog):
    def __init__(self, parent):
        QDialog.__init__(self, parent)
        self.setWindowTitle("Spyder %s: %s" % (__version__, _("Optional Dependencies")))
        self.setModal(True)

        self.view = DependenciesTableView(self, [])

        important_mods = ["rope", "pyflakes", "IPython", "matplotlib"]
        self.label = QLabel(
            _(
                "Spyder depends on several Python modules to "
                "provide additional functionality for its "
                "plugins. The table below shows the required "
                "and installed versions (if any) of all of "
                "them.<br><br>"
                "Although Spyder can work without any of these "
                "modules, it's strongly recommended that at "
                "least you try to install <b>%s</b> and "
                "<b>%s</b> to have a much better experience."
            )
            % (", ".join(important_mods[:-1]), important_mods[-1])
        )
        self.label.setWordWrap(True)
        self.label.setAlignment(Qt.AlignJustify)
        self.label.setContentsMargins(5, 8, 12, 10)

        btn = QPushButton(_("Copy to clipboard"))
        self.connect(btn, SIGNAL("clicked()"), self.copy_to_clipboard)
        bbox = QDialogButtonBox(QDialogButtonBox.Ok)
        self.connect(bbox, SIGNAL("accepted()"), SLOT("accept()"))
        hlayout = QHBoxLayout()
        hlayout.addWidget(btn)
        hlayout.addStretch()
        hlayout.addWidget(bbox)

        vlayout = QVBoxLayout()
        vlayout.addWidget(self.label)
        vlayout.addWidget(self.view)
        vlayout.addLayout(hlayout)

        self.setLayout(vlayout)
        self.resize(560, 350)

    def set_data(self, dependencies):
        self.view.model.set_data(dependencies)
        self.view.adjust_columns()
        self.view.sortByColumn(0, Qt.DescendingOrder)

    def copy_to_clipboard(self):
        from spyderlib.dependencies import status

        QApplication.clipboard().setText(status())
开发者ID:alfonsodiecko,项目名称:PYTHON_DIST,代码行数:55,代码来源:dependencies.py

示例2: DependenciesDialog

# 需要导入模块: from spyderlib.qt.QtGui import QLabel [as 别名]
# 或者: from spyderlib.qt.QtGui.QLabel import setContentsMargins [as 别名]
class DependenciesDialog(QDialog):
    def __init__(self, parent):
        QDialog.__init__(self, parent)
        self.setWindowTitle("Spyder %s: %s" % (__version__,
                                               _("Dependencies")))
        self.setWindowIcon(ima.icon('tooloptions'))
        self.setModal(True)

        self.view = DependenciesTableView(self, [])

        opt_mods = ['NumPy', 'Matplotlib', 'Pandas', 'SymPy']
        self.label = QLabel(_("Spyder depends on several Python modules to "
                              "provide the right functionality for all its "
                              "panes. The table below shows the required "
                              "and installed versions (if any) of all of "
                              "them.<br><br>"
                              "<b>Note</b>: You can safely use Spyder "
                              "without the following modules installed: "
                              "<b>%s</b> and <b>%s</b>")
                              % (', '.join(opt_mods[:-1]), opt_mods[-1]))
        self.label.setWordWrap(True)
        self.label.setAlignment(Qt.AlignJustify)
        self.label.setContentsMargins(5, 8, 12, 10)

        btn = QPushButton(_("Copy to clipboard"), )
        btn.clicked.connect(self.copy_to_clipboard)
        bbox = QDialogButtonBox(QDialogButtonBox.Ok)
        bbox.accepted.connect(self.accept)
        hlayout = QHBoxLayout()
        hlayout.addWidget(btn)
        hlayout.addStretch()
        hlayout.addWidget(bbox)

        vlayout = QVBoxLayout()
        vlayout.addWidget(self.label)
        vlayout.addWidget(self.view)
        vlayout.addLayout(hlayout)

        self.setLayout(vlayout)
        self.resize(630, 420)
        
    def set_data(self, dependencies):
        self.view.model.set_data(dependencies)
        self.view.adjust_columns()
        self.view.sortByColumn(0, Qt.DescendingOrder)
    
    def copy_to_clipboard(self):
        from spyderlib.dependencies import status
        QApplication.clipboard().setText(status())
开发者ID:AminJamalzadeh,项目名称:spyder,代码行数:51,代码来源:dependencies.py


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