本文整理汇总了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())
示例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())