本文整理匯總了Python中pyqtgraph.Qt.QtGui.QLabel方法的典型用法代碼示例。如果您正苦於以下問題:Python QtGui.QLabel方法的具體用法?Python QtGui.QLabel怎麽用?Python QtGui.QLabel使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類pyqtgraph.Qt.QtGui
的用法示例。
在下文中一共展示了QtGui.QLabel方法的10個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: __init__
# 需要導入模塊: from pyqtgraph.Qt import QtGui [as 別名]
# 或者: from pyqtgraph.Qt.QtGui import QLabel [as 別名]
def __init__(self, info_data, *args, **kwargs):
super().__init__(*args, **kwargs)
self.resize(QtCore.QSize(500,500))
self.info_table = QtGui.QTableWidget()
self.setCentralWidget(self.info_table)
self.info_table.setSortingEnabled(False)
self.info_table.horizontalHeader().setStretchLastSection(True)
self.info_table.resizeColumnsToContents()
self.info_table.setColumnCount(2)
self.info_table.setColumnWidth(0, 120)
self.info_table.setColumnWidth(1, 50)
self.info_table.setHorizontalHeaderLabels(['Name', 'value'])
index = 0
for name, value in info_data.items():
self.info_table.insertRow(index)
self.info_table.setCellWidget(index, 0, QtGui.QLabel(name))
self.info_table.setCellWidget(index, 1, QtGui.QLabel(str(value)))
index += 1
# self.info_table.setCellWidget(index, 0, QtGui.QLabel(des))
示例2: update_table
# 需要導入模塊: from pyqtgraph.Qt import QtGui [as 別名]
# 或者: from pyqtgraph.Qt.QtGui import QLabel [as 別名]
def update_table(self):
self.params_table.setRowCount(0)
index = 0
for name, value in self.params_data.items():
if name in self.params_data_show:
self.params_table.insertRow(index)
if name in self.changed_params_data:
name_str = "<font color='red'>%s</font>"%(name)
value_str = "<font color='red'>%s</font>"%(str(value))
else:
name_str = name
value_str = str(value)
name_lbl = QtGui.QLabel(name_str)
value_lbl = QtGui.QLabel(value_str)
self.params_table.setCellWidget(index, 0, name_lbl)
self.params_table.setCellWidget(index, 1, value_lbl)
index += 1
示例3: initMaskFunctionControls
# 需要導入模塊: from pyqtgraph.Qt import QtGui [as 別名]
# 或者: from pyqtgraph.Qt.QtGui import QLabel [as 別名]
def initMaskFunctionControls(self):
self.maskFunctionControlslayout = QtGui.QHBoxLayout()
labelsLayout = QtGui.QVBoxLayout()
slidersLayout = QtGui.QVBoxLayout()
self.maskFunctionControlslayout.addLayout(labelsLayout)
self.maskFunctionControlslayout.addLayout(slidersLayout)
def addSlider(label, changedFunction, minimum, maximum, value):
labelWidget = QtGui.QLabel(label)
labelsLayout.addWidget(labelWidget)
slider = QtGui.QSlider(QtCore.Qt.Horizontal)
slider.setMinimum(minimum)
slider.setMaximum(maximum)
slider.setValue(value)
slider.sliderReleased.connect(changedFunction)
slidersLayout.addWidget(slider)
return slider, labelWidget
self.targetModeWindowTDOASlider, self.targetModeWindowTDOALabel = addSlider('Center:', self.tdoaRegionChanged, 0, 100, 50)
self.targetModeWindowWidthSlider, _ = addSlider('Width:', self.tdoaRegionChanged, 1, 101, 50)
self.targetModeWindowBetaSlider, _ = addSlider('Shape:', self.tdoaRegionChanged, 0, 100, 50)
self.targetModeWindowNoiseFloorSlider, _ = addSlider('Floor:', self.tdoaRegionChanged, 0, 100, 0)
示例4: initNMFControls
# 需要導入模塊: from pyqtgraph.Qt import QtGui [as 別名]
# 或者: from pyqtgraph.Qt.QtGui import QLabel [as 別名]
def initNMFControls(self):
self.nmfControlsLayout = QtGui.QHBoxLayout()
self.nmfControlsLayout.addStretch(1)
self.nmfControlsLayout.addWidget(QtGui.QLabel('Dictionary Size:'))
self.dictionarySizeDropDown = QtGui.QComboBox()
for dictionarySize in self.dictionarySizes:
self.dictionarySizeDropDown.addItem( str(dictionarySize) )
self.dictionarySizeDropDown.setMaximumWidth(75)
self.dictionarySizeDropDown.setCurrentIndex(self.dictionarySizes.index(self.dictionarySize))
self.dictionarySizeDropDown.currentIndexChanged.connect(self.dictionarySizeChanged)
self.nmfControlsLayout.addWidget(self.dictionarySizeDropDown)
self.nmfControlsLayout.addStretch(1)
self.nmfControlsLayout.addWidget(QtGui.QLabel('Num Updates:'))
self.numHUpdatesSpinBox = QtGui.QSpinBox()
self.nmfControlsLayout.addWidget(self.numHUpdatesSpinBox)
self.nmfControlsLayout.addStretch(1)
示例5: initLocalizationControls
# 需要導入模塊: from pyqtgraph.Qt import QtGui [as 別名]
# 或者: from pyqtgraph.Qt.QtGui import QLabel [as 別名]
def initLocalizationControls(self):
self.localizationControlsLayout = QtGui.QHBoxLayout()
self.localizationControlsLayout.addStretch(3)
self.localizationCheckBox = QtGui.QCheckBox('Enable Localization')
self.localizationCheckBox.setChecked(self.localizationEnabled)
self.localizationCheckBox.stateChanged.connect(self.localizationStateChanged)
self.localizationControlsLayout.addWidget(self.localizationCheckBox)
self.localizationControlsLayout.addStretch(1)
self.localizationWindowSizeLabel = QtGui.QLabel('Sliding Window Size:')
self.localizationControlsLayout.addWidget(self.localizationWindowSizeLabel)
self.localziaitonWindowSizeSpinBox = QtGui.QSpinBox()
self.localziaitonWindowSizeSpinBox.setMinimum(1)
self.localziaitonWindowSizeSpinBox.setMaximum(128)
self.localziaitonWindowSizeSpinBox.setValue(self.localizationWindowSize)
self.localziaitonWindowSizeSpinBox.valueChanged.connect(self.localizationParamsChanged)
self.localizationControlsLayout.addWidget(self.localziaitonWindowSizeSpinBox)
self.localizationControlsLayout.addStretch(3)
示例6: run
# 需要導入模塊: from pyqtgraph.Qt import QtGui [as 別名]
# 或者: from pyqtgraph.Qt.QtGui import QLabel [as 別名]
def run(self):
self.dialog.setText('Loading...')
self.dialog.setStyleSheet('QLabel{min-width: 100px;}')
self.dialog.show()
示例7: __init__
# 需要導入模塊: from pyqtgraph.Qt import QtGui [as 別名]
# 或者: from pyqtgraph.Qt.QtGui import QLabel [as 別名]
def __init__(self, parent):
QtGui.QLabel.__init__(self, parent)
self.UIsAreSet = False
示例8: __init__
# 需要導入模塊: from pyqtgraph.Qt import QtGui [as 別名]
# 或者: from pyqtgraph.Qt.QtGui import QLabel [as 別名]
def __init__(self, parent=None):
super(App, self).__init__(parent)
#### Create Gui Elements ###########
self.mainbox = QtGui.QWidget()
self.setCentralWidget(self.mainbox)
self.mainbox.setLayout(QtGui.QVBoxLayout())
self.canvas = pg.GraphicsLayoutWidget()
self.mainbox.layout().addWidget(self.canvas)
self.label = QtGui.QLabel()
self.mainbox.layout().addWidget(self.label)
self.view = self.canvas.addViewBox()
self.view.setAspectLocked(True)
self.view.setRange(QtCore.QRectF(0,0, 100, 100))
# image plot
self.img = pg.ImageItem(border='w')
self.view.addItem(self.img)
self.canvas.nextRow()
# line plot
self.otherplot = self.canvas.addPlot()
self.h2 = self.otherplot.plot(pen='y')
#### Set Data #####################
self.x = np.linspace(0,50., num=100)
self.X,self.Y = np.meshgrid(self.x,self.x)
self.counter = 0
self.fps = 0.
self.lastupdate = time.time()
#### Start #####################
self._update()
示例9: initWindowLayout
# 需要導入模塊: from pyqtgraph.Qt import QtGui [as 別名]
# 或者: from pyqtgraph.Qt.QtGui import QLabel [as 別名]
def initWindowLayout(self):
sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Expanding)
sizePolicy.setHorizontalStretch(1)
sizePolicy.setVerticalStretch(1)
self.infoLabelWidgets = []
def addWidgetWithLabel(widget, label, fromRow, fromColumn, rowSpan=1, columnSpan=1):
labeledWidget = QtGui.QWidget()
widgetLayout = QtGui.QVBoxLayout()
widgetLayout.setContentsMargins(0, 0, 0, 0)
widgetLayout.setSpacing(1)
labeledWidget.setLayout(widgetLayout)
labelWidget = QtGui.QLabel(label)
labelWidget.setContentsMargins(0, 3, 0, 1)
labelWidget.setAutoFillBackground(True)
labelWidget.setAlignment(QtCore.Qt.AlignCenter)
#labelWidget.setStyleSheet('QLabel { border-top-width: 10px }')
self.infoLabelWidgets.append(labelWidget)
widgetLayout.addWidget(labelWidget)
widgetLayout.addWidget(widget)
labeledWidget.setSizePolicy(sizePolicy)
self.mainLayout.addWidget(labeledWidget, fromRow, fromColumn, rowSpan, columnSpan)
addWidgetWithLabel(self.inputSpectrogramWidget, 'Input Spectrogram', 0, 1)
addWidgetWithLabel(self.outputSpectrogramWidget, 'Output Spectrogram', 1, 1)
addWidgetWithLabel(self.controlsWidget, 'GCC-NMF Masking Function', 0, 2)
addWidgetWithLabel(self.gccPHATHistoryWidget, 'GCC PHAT Angular Spectrogram', 0, 3)
addWidgetWithLabel(self.dictionaryWidget, 'NMF Dictionary', 1, 2)
addWidgetWithLabel(self.coefficientMaskWidget, 'NMF Dictionary Mask', 1, 3)
#for widget in self.infoLabelWidgets:
# widget.hide()
#map(lambda widget: widget.hide(), self.infoLabelWidgets)
示例10: update_graph
# 需要導入模塊: from pyqtgraph.Qt import QtGui [as 別名]
# 或者: from pyqtgraph.Qt.QtGui import QLabel [as 別名]
def update_graph(self):
# update tableView
# clear
self.plotting_data_tableView.setRowCount(0)
# add
for ind, (item_id, item) in enumerate(self.data_plotting.items()):
self.plotting_data_tableView.insertRow(ind)
self.plotting_data_tableView.setCellWidget(ind, 0, QtGui.QLabel(item[0]))
chkbox = Checkbox(item_id, '')
chkbox.setChecked(item[1])
chkbox.sigStateChanged.connect(self.callback_visible_changed)
self.plotting_data_tableView.setCellWidget(ind, 1, chkbox)
curve = item[2]
color = curve.opts['pen']
if isinstance(color, QtGui.QColor):
color = color.red(), color.green(), color.blue()
marker = curve.opts['symbol']
marker_dict = OrderedDict([(None,'None'), ('s','☐'), ('t','▽'), ('o','○'), ('+','+')])
color_text = '#{0[0]:02x}{0[1]:02x}{0[2]:02x}'.format(color)
lbl_txt = "<font color='{0}'>{1}</font> {2}".format(color_text,'▇▇',str(marker_dict[marker]))
lbl = PropertyLabel(item_id, self, lbl_txt)
lbl.sigPropertyChanged.connect(self.callback_property_changed)
self.plotting_data_tableView.setCellWidget(ind, 2, lbl)
# update curve
# remove curves in graph
items_to_be_removed = []
for item in self.main_graph_t.items:
if isinstance(item, pg.PlotDataItem):
items_to_be_removed.append(item)
for item in items_to_be_removed:
self.main_graph_t.removeItem(item)
self.main_graph_t.legend.scene().removeItem(self.main_graph_t.legend)
self.main_graph_t.addLegend()
# redraw curves
for ind, (item_id, item) in enumerate(self.data_plotting.items()):
label, showed, curve = item
color = curve.opts['pen']
if isinstance(color, QtGui.QColor):
color = color.red(), color.green(), color.blue()
data = curve.xData, curve.yData
marker = curve.opts['symbol']
symbolSize = curve.opts['symbolSize']
if showed:
curve = self.main_graph_t.plot(data[0], data[1], symbol=marker, pen=color, name=label, symbolSize=symbolSize)
self.data_plotting[item_id][2] = curve
self.update_ROI_graph()