本文整理匯總了Python中qtpy.QtWidgets.QLabel方法的典型用法代碼示例。如果您正苦於以下問題:Python QtWidgets.QLabel方法的具體用法?Python QtWidgets.QLabel怎麽用?Python QtWidgets.QLabel使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類qtpy.QtWidgets
的用法示例。
在下文中一共展示了QtWidgets.QLabel方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: __init__
# 需要導入模塊: from qtpy import QtWidgets [as 別名]
# 或者: from qtpy.QtWidgets import QLabel [as 別名]
def __init__(self, layout: QtWidgets.QLayout, text: str, values: Sequence):
""" A combo box widget with a label
Args:
layout: the layout to which to add the widget
text: the label text
values: the possible values of the combo box
"""
QtWidgets.QWidget.__init__(self)
layout.addWidget(self)
self.layout = QtWidgets.QHBoxLayout(self)
self.label = QtWidgets.QLabel(text)
self.layout.addWidget(self.label)
self.layout.setContentsMargins(0, 0, 0, 0)
self.values = values
self.input1 = QtWidgets.QComboBox()
self.input1.addItems(values)
self.layout.addWidget(self.input1)
self.input1.currentIndexChanged.connect(self.valueChangeEvent)
self.layout.addWidget(self.input1)
示例2: __init__
# 需要導入模塊: from qtpy import QtWidgets [as 別名]
# 或者: from qtpy.QtWidgets import QLabel [as 別名]
def __init__(self, layer):
super().__init__(layer)
colormap_layout = QHBoxLayout()
colormap_layout.addWidget(self.colorbarLabel)
colormap_layout.addWidget(self.colormapComboBox)
colormap_layout.addStretch(1)
# grid_layout created in QtLayerControls
# addWidget(widget, row, column, [row_span, column_span])
self.grid_layout.addWidget(QLabel('opacity:'), 0, 0)
self.grid_layout.addWidget(self.opacitySlider, 0, 1)
self.grid_layout.addWidget(QLabel('contrast limits:'), 1, 0)
self.grid_layout.addWidget(self.contrastLimitsSlider, 1, 1)
self.grid_layout.addWidget(QLabel('gamma:'), 2, 0)
self.grid_layout.addWidget(self.gammaSlider, 2, 1)
self.grid_layout.addWidget(QLabel('colormap:'), 3, 0)
self.grid_layout.addLayout(colormap_layout, 3, 1)
self.grid_layout.addWidget(QLabel('blending:'), 4, 0)
self.grid_layout.addWidget(self.blendComboBox, 4, 1)
self.grid_layout.setRowStretch(5, 1)
self.grid_layout.setColumnStretch(1, 1)
self.grid_layout.setSpacing(4)
示例3: font
# 需要導入模塊: from qtpy import QtWidgets [as 別名]
# 或者: from qtpy.QtWidgets import QLabel [as 別名]
def font(prefix, size):
"""
Return the font corresponding to the specified prefix.
This can be used to render text using the iconic font directly::
import qtawesome as qta
from qtpy import QtWidgets
label = QtWidgets.QLabel(unichr(0xf19c) + ' ' + 'Label')
label.setFont(qta.font('fa', 16))
Parameters
----------
prefix: str
prefix string of the loaded font
size: int
size for the font
"""
return _instance().font(prefix, size)
示例4: make_layout
# 需要導入模塊: from qtpy import QtWidgets [as 別名]
# 或者: from qtpy.QtWidgets import QLabel [as 別名]
def make_layout(self):
self.lay = QtWidgets.QHBoxLayout()
self.lay.setContentsMargins(0, 0, 0, 0)
self.real = FloatSpinBox(label=self.labeltext,
min=self.minimum,
max=self.maximum,
increment=self.singleStep,
log_increment=self.log_increment,
halflife_seconds=self.halflife_seconds,
decimals=self.decimals)
self.imag = FloatSpinBox(label=self.labeltext,
min=self.minimum,
max=self.maximum,
increment=self.singleStep,
log_increment=self.log_increment,
halflife_seconds=self.halflife_seconds,
decimals=self.decimals)
self.real.value_changed.connect(self.value_changed)
self.lay.addWidget(self.real)
self.label = QtWidgets.QLabel(" + j")
self.lay.addWidget(self.label)
self.imag.value_changed.connect(self.value_changed)
self.lay.addWidget(self.imag)
self.setLayout(self.lay)
self.setFocusPolicy(QtCore.Qt.ClickFocus)
示例5: __init__
# 需要導入模塊: from qtpy import QtWidgets [as 別名]
# 或者: from qtpy.QtWidgets import QLabel [as 別名]
def __init__(self, module, attribute_name, widget_name=None):
super(BaseAttributeWidget, self).__init__()
self.module = module
self.attribute_name = attribute_name
if widget_name is None:
self.widget_name = self.attribute_name
else:
self.widget_name = widget_name
self.setToolTip(self.attribute_descriptor.__doc__)
self.layout_v = QtWidgets.QVBoxLayout()
self.layout = self.layout_v
if self.widget_name != "":
self.label = QtWidgets.QLabel(self.widget_name)
self.layout.addWidget(self.label, 0) # stretch=0
self.layout.addStretch(1)
self.layout_v.setContentsMargins(0, 0, 0, 0)
self._make_widget()
self.layout.addWidget(self.widget, 0) # stretch=0
self.layout.addStretch(1)
self.setLayout(self.layout)
self.write_attribute_value_to_widget()
# this is very nice for debugging, but should probably be removed later
setattr(self.module, '_'+self.attribute_name+'_widget', self)
示例6: __init__
# 需要導入模塊: from qtpy import QtWidgets [as 別名]
# 或者: from qtpy.QtWidgets import QLabel [as 別名]
def __init__(self, widget_name, y, label, parent, x_offset=0):
super(MyItem, self).__init__()
self.lay = QtWidgets.QVBoxLayout()
self.setLayout(self.lay)
self.item = QtWidgets.QLabel(label)
self.setStyleSheet('background-color:transparent')
self.lay.addWidget(self.item)
self.widget_name = widget_name
self.y = y
self.x_offset = x_offset
self.parent = parent
parent.graphic_items.append(self)
self.item.setStyleSheet(
"QLabel{border: 1px solid black; border-radius: 5px; "
"font-size: 15px; background-color:white}")
self.proxy = parent.scene.addWidget(self)
self.proxy.setZValue(2)
示例7: create_title_bar
# 需要導入模塊: from qtpy import QtWidgets [as 別名]
# 或者: from qtpy.QtWidgets import QLabel [as 別名]
def create_title_bar(self):
self.title_label = QtWidgets.QLabel("yo", parent=self)
# title should be at the top-left corner of the widget
self.load_label = LoadLabel(self)
self.load_label.adjustSize()
self.save_label = SaveLabel(self)
self.save_label.adjustSize()
self.erase_label = EraseLabel(self)
self.erase_label.adjustSize()
self.edit_label = EditLabel(self)
self.edit_label.adjustSize()
self.hideshow_label = HideShowLabel(self)
self.hideshow_label.adjustSize()
# self.setStyleSheet("ModuleWidget{border: 1px dashed gray;color: black;}")
self.setStyleSheet("ModuleWidget{margin: 0.1em; margin-top:0.6em; border: 1 dotted gray;border-radius:5}")
# margin-top large enough for border to be in the middle of title
self.layout().setContentsMargins(0, 5, 0, 0)
示例8: __init__
# 需要導入模塊: from qtpy import QtWidgets [as 別名]
# 或者: from qtpy.QtWidgets import QLabel [as 別名]
def __init__(self, axis: str, signal_target_changed: QtCore.Signal):
""" A widget to change the tick properties
Args:
axis: whether to use the "x" or "y" axis
signal_target_changed: a signal to emit when the target changed
"""
QtWidgets.QWidget.__init__(self)
self.setWindowTitle("Figure - " + axis + "-Axis - Ticks - Pylustrator")
self.setWindowIcon(QtGui.QIcon(os.path.join(os.path.dirname(__file__), "icons", "ticks.ico")))
self.layout = QtWidgets.QVBoxLayout(self)
self.axis = axis
self.label = QtWidgets.QLabel(
"Ticks can be specified, one tick pre line.\nOptionally a label can be provided, e.g. 1 \"First\",")
self.layout.addWidget(self.label)
self.layout2 = QtWidgets.QHBoxLayout()
self.layout.addLayout(self.layout2)
self.input_ticks = TextWidget(self.layout2, axis + "-Ticks:", multiline=True, horizontal=False)
self.input_ticks.editingFinished.connect(self.ticksChanged)
self.input_ticks2 = TextWidget(self.layout2, axis + "-Ticks (minor):", multiline=True, horizontal=False)
self.input_ticks2.editingFinished.connect(self.ticksChanged2)
self.input_scale = ComboWidget(self.layout, axis + "-Scale", ["linear", "log", "symlog", "logit"])
self.input_scale.link(axis + "scale", signal_target_changed)
self.input_font = TextPropertiesWidget(self.layout)
self.input_labelpad = NumberWidget(self.layout, axis + "-Labelpad", min=-999)
self.input_labelpad.link(axis + "axis.labelpad", signal_target_changed, direct=True)
self.button_ok = QtWidgets.QPushButton("Ok")
self.layout.addWidget(self.button_ok)
self.button_ok.clicked.connect(self.hide)
示例9: create_widget
# 需要導入模塊: from qtpy import QtWidgets [as 別名]
# 或者: from qtpy.QtWidgets import QLabel [as 別名]
def create_widget():
widget = QWidget()
layout = QHBoxLayout()
widget.setLayout(layout)
widget.status = QLabel('ready...')
layout.addWidget(widget.status)
widget.show()
return widget
示例10: __init__
# 需要導入模塊: from qtpy import QtWidgets [as 別名]
# 或者: from qtpy.QtWidgets import QLabel [as 別名]
def __init__(self, parent, plugin_manager=None):
super().__init__(parent)
if not plugin_manager:
from ..plugins import plugin_manager
self.setMaximumHeight(800)
self.setMaximumWidth(1280)
layout = QVBoxLayout()
# maybe someday add a search bar here?
title = QLabel("Installed Plugins")
title.setObjectName("h2")
layout.addWidget(title)
# get metadata for successfully registered plugins
plugin_manager.discover()
data = plugin_manager.list_plugin_metadata()
data = list(filter(lambda x: x['plugin_name'] != 'builtins', data))
# create a table for it
self.table = QtDictTable(
parent,
data,
headers=[
'plugin_name',
'package',
'version',
'url',
'author',
'license',
],
min_section_width=60,
)
self.table.setObjectName("pluginTable")
self.table.horizontalHeader().setObjectName("pluginTableHeader")
self.table.verticalHeader().setObjectName("pluginTableHeader")
self.table.setGridStyle(Qt.NoPen)
# prevent editing of table
self.table.setEditTriggers(QAbstractItemView.NoEditTriggers)
layout.addWidget(self.table)
self.setLayout(layout)
self.setAttribute(Qt.WA_DeleteOnClose)
示例11: setRevisionTableColumn
# 需要導入模塊: from qtpy import QtWidgets [as 別名]
# 或者: from qtpy.QtWidgets import QLabel [as 別名]
def setRevisionTableColumn(self, row, column, value, icon=None, isLongText=False):
value = str(value)
widget = QtWidgets.QWidget()
layout = QtWidgets.QHBoxLayout()
layout.setAlignment(QtCore.Qt.AlignLeft | QtCore.Qt.AlignHCenter)
# Use a QLineEdit to allow the text to be copied if the data is large
if isLongText:
textLabel = QtWidgets.QLineEdit()
textLabel.setText(value)
textLabel.setCursorPosition(0)
textLabel.setReadOnly(True)
textLabel.setStyleSheet("QLineEdit { border: none }")
else:
textLabel = QtWidgets.QLabel(value)
textLabel.setStyleSheet("QLabel { border: none } ")
# layout.setContentsMargins(4, 0, 4, 0)
if icon:
iconPic = QtGui.QPixmap(icon)
iconPic = iconPic.scaled(16, 16)
iconLabel = QtWidgets.QLabel()
iconLabel.setPixmap(iconPic)
layout.addWidget(iconLabel)
layout.addWidget(textLabel)
widget.setLayout(layout)
self.tableWidget.setCellWidget(row, column, widget)
示例12: __init__
# 需要導入模塊: from qtpy import QtWidgets [as 別名]
# 或者: from qtpy.QtWidgets import QLabel [as 別名]
def __init__(self, parent, title, message):
super().__init__(parent)
self.setWindowTitle(title)
vbox = QVBoxLayout(self)
label = QLabel(message)
button = QDialogButtonBox(QDialogButtonBox.Cancel)
button.rejected.connect(self.close)
vbox.addWidget(label)
vbox.addWidget(button)
示例13: setup_page
# 需要導入模塊: from qtpy import QtWidgets [as 別名]
# 或者: from qtpy.QtWidgets import QLabel [as 別名]
def setup_page(self):
settings_group = QGroupBox(_("Settings"))
use_color_box = self.create_checkbox(
_("Use deterministic colors to differentiate functions"),
'use_colors', default=True)
results_group = QGroupBox(_("Results"))
results_label1 = QLabel(_("Line profiler plugin results "
"(the output of kernprof.py)\n"
"are stored here:"))
results_label1.setWordWrap(True)
# Warning: do not try to regroup the following QLabel contents with
# widgets above -- this string was isolated here in a single QLabel
# on purpose: to fix Issue 863 of Profiler plugon
results_label2 = QLabel(LineProfilerWidget.DATAPATH)
results_label2.setTextInteractionFlags(Qt.TextSelectableByMouse)
results_label2.setWordWrap(True)
settings_layout = QVBoxLayout()
settings_layout.addWidget(use_color_box)
settings_group.setLayout(settings_layout)
results_layout = QVBoxLayout()
results_layout.addWidget(results_label1)
results_layout.addWidget(results_label2)
results_group.setLayout(results_layout)
vlayout = QVBoxLayout()
vlayout.addWidget(settings_group)
vlayout.addWidget(results_group)
vlayout.addStretch(1)
self.setLayout(vlayout)
示例14: __init__
# 需要導入模塊: from qtpy import QtWidgets [as 別名]
# 或者: from qtpy.QtWidgets import QLabel [as 別名]
def __init__(self, parent):
super(AnalogTfSpec, self).__init__(parent)
self.parent = parent
self.module = self.parent.module
self.layout = QtWidgets.QVBoxLayout(self)
self.label = QtWidgets.QLabel("Analog transfer function")
self.layout.addWidget(self.label)
self.button = QtWidgets.QPushButton('Change...')
self.layout.addWidget(self.button)
self.button.clicked.connect(self.change)
self.dialog = AnalogTfDialog(self)
self.layout.setContentsMargins(0,0,0,0)
self.change_analog_tf()
示例15: __init__
# 需要導入模塊: from qtpy import QtWidgets [as 別名]
# 或者: from qtpy.QtWidgets import QLabel [as 別名]
def __init__(self, parent=None):
super(CurrentAvgLabel, self).__init__(parent)
self.main_lay = QtWidgets.QVBoxLayout()
self.setLayout(self.main_lay)
self.label = QtWidgets.QLabel("current_avg")
self.main_lay.addWidget(self.label)
self.value_label = QtWidgets.QLabel("0 /")
self.main_lay.addWidget(self.value_label)
self.main_lay.addStretch(1)
self.value_label.setAlignment(QtCore.Qt.AlignCenter)
self.main_lay.setContentsMargins(0,0,0,0)