本文整理汇总了Python中PySide2.QtWidgets.QLabel方法的典型用法代码示例。如果您正苦于以下问题:Python QtWidgets.QLabel方法的具体用法?Python QtWidgets.QLabel怎么用?Python QtWidgets.QLabel使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PySide2.QtWidgets
的用法示例。
在下文中一共展示了QtWidgets.QLabel方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from PySide2 import QtWidgets [as 别名]
# 或者: from PySide2.QtWidgets import QLabel [as 别名]
def __init__(self, parent=None):
super(HotboxGeneralInfosWidget, self).__init__(parent)
self.setFixedWidth(200)
self.label = QtWidgets.QLabel()
self.open_command = CommandButton('show')
self.close_command = CommandButton('hide')
self.switch_command = CommandButton('switch')
self.layout = QtWidgets.QVBoxLayout(self)
self.layout.setContentsMargins(0, 0, 0, 0)
self.layout.setSpacing(0)
self.layout.addWidget(Title('Infos'))
self.layout.addSpacing(8)
self.layout.addWidget(self.label)
self.layout.addSpacing(8)
self.layout.addStretch(1)
self.layout.addWidget(Title('Commands'))
self.layout.addSpacing(8)
self.layout.addWidget(self.open_command)
self.layout.addWidget(self.close_command)
self.layout.addWidget(self.switch_command)
示例2: __init__
# 需要导入模块: from PySide2 import QtWidgets [as 别名]
# 或者: from PySide2.QtWidgets import QLabel [as 别名]
def __init__(self):
super(ButtonAndLongProcess, self).__init__()
self.button = QPushButton("button")
self.button.clicked.connect(self.buttonClicked)
self.label = QLabel("label: before clicked")
layout = QVBoxLayout()
layout.addWidget(self.button)
layout.addWidget(self.label)
self.setLayout(layout)
self.long_process_thread = LongProcessThread()
self.long_process_thread.transaction.connect(self.afterLongProcess)
开发者ID:PacktPublishing,项目名称:Hands-On-Blockchain-for-Python-Developers,代码行数:18,代码来源:button_and_long_process.py
示例3: createTweetsGroupBox
# 需要导入模块: from PySide2 import QtWidgets [as 别名]
# 或者: from PySide2.QtWidgets import QLabel [as 别名]
def createTweetsGroupBox(self):
self.tweets_group_box = QtWidgets.QGroupBox("Tweets")
self.account_address = QtWidgets.QLineEdit()
self.fetch_button = QtWidgets.QPushButton("Fetch")
self.add_to_bookmark_button = QtWidgets.QPushButton("Bookmark it!")
self.connect(self.fetch_button, QtCore.SIGNAL('clicked()'), self.fetchTweets)
self.connect(self.add_to_bookmark_button, QtCore.SIGNAL('clicked()'), self.bookmarkAddress)
account_address_layout = QtWidgets.QHBoxLayout()
account_address_layout.addWidget(self.account_address)
account_address_layout.addWidget(self.fetch_button)
account_address_layout.addWidget(self.add_to_bookmark_button)
self.tweets_layout = QtWidgets.QVBoxLayout()
self.tweets_main_layout = QtWidgets.QVBoxLayout()
self.tweets_main_layout.addWidget(QtWidgets.QLabel("Address:"))
self.tweets_main_layout.addLayout(account_address_layout)
self.tweets_main_layout.addSpacing(20)
self.tweets_main_layout.addLayout(self.tweets_layout)
self.tweets_group_box.setLayout(self.tweets_main_layout)
示例4: setLang
# 需要导入模块: from PySide2 import QtWidgets [as 别名]
# 或者: from PySide2.QtWidgets import QLabel [as 别名]
def setLang(self, langName):
uiList_lang_read = self.memoData['lang'][langName]
for ui_name in uiList_lang_read:
ui_element = self.uiList[ui_name]
if type(ui_element) in [ QtWidgets.QLabel, QtWidgets.QPushButton, QtWidgets.QAction, QtWidgets.QCheckBox ]:
# uiType: QLabel, QPushButton, QAction(menuItem), QCheckBox
if uiList_lang_read[ui_name] != "":
ui_element.setText(uiList_lang_read[ui_name])
elif type(ui_element) in [ QtWidgets.QGroupBox, QtWidgets.QMenu ]:
# uiType: QMenu, QGroupBox
if uiList_lang_read[ui_name] != "":
ui_element.setTitle(uiList_lang_read[ui_name])
elif type(ui_element) in [ QtWidgets.QTabWidget]:
# uiType: QTabWidget
tabCnt = ui_element.count()
if uiList_lang_read[ui_name] != "":
tabNameList = uiList_lang_read[ui_name].split(';')
if len(tabNameList) == tabCnt:
for i in range(tabCnt):
if tabNameList[i] != "":
ui_element.setTabText(i,tabNameList[i])
elif type(ui_element) == str:
# uiType: string for msg
if uiList_lang_read[ui_name] != "":
self.uiList[ui_name] = uiList_lang_read[ui_name]
示例5: quickMsg
# 需要导入模块: from PySide2 import QtWidgets [as 别名]
# 或者: from PySide2.QtWidgets import QLabel [as 别名]
def quickMsg(self, msg, block=1):
tmpMsg = QtWidgets.QMessageBox(self) # for simple msg that no need for translation
tmpMsg.setWindowTitle("Info")
lineCnt = len(msg.split('\n'))
if lineCnt > 25:
scroll = QtWidgets.QScrollArea()
scroll.setWidgetResizable(1)
content = QtWidgets.QWidget()
scroll.setWidget(content)
layout = QtWidgets.QVBoxLayout(content)
tmpLabel = QtWidgets.QLabel(msg)
tmpLabel.setTextInteractionFlags(QtCore.Qt.TextSelectableByMouse)
layout.addWidget(tmpLabel)
tmpMsg.layout().addWidget(scroll, 0, 0, 1, tmpMsg.layout().columnCount())
tmpMsg.setStyleSheet("QScrollArea{min-width:600 px; min-height: 400px}")
else:
tmpMsg.setText(msg)
if block == 0:
tmpMsg.setWindowModality( QtCore.Qt.NonModal )
tmpMsg.addButton("OK",QtWidgets.QMessageBox.YesRole)
if block:
tmpMsg.exec_()
else:
tmpMsg.show()
示例6: quickMsg
# 需要导入模块: from PySide2 import QtWidgets [as 别名]
# 或者: from PySide2.QtWidgets import QLabel [as 别名]
def quickMsg(self, msg, block=1):
tmpMsg = QtWidgets.QMessageBox(self) # for simple msg that no need for translation
tmpMsg.setWindowTitle("Info")
lineCnt = len(msg.split('\n'))
if lineCnt > 25:
scroll = QtWidgets.QScrollArea()
scroll.setWidgetResizable(1)
content = QtWidgets.QWidget()
scroll.setWidget(content)
layout = QtWidgets.QVBoxLayout(content)
layout.addWidget(QtWidgets.QLabel(msg))
tmpMsg.layout().addWidget(scroll, 0, 0, 1, tmpMsg.layout().columnCount())
tmpMsg.setStyleSheet("QScrollArea{min-width:600 px; min-height: 400px}")
else:
tmpMsg.setText(msg)
if block == 0:
tmpMsg.setWindowModality( QtCore.Qt.NonModal )
tmpMsg.addButton("OK",QtWidgets.QMessageBox.YesRole)
if block:
tmpMsg.exec_()
else:
tmpMsg.show()
示例7: __init__
# 需要导入模块: from PySide2 import QtWidgets [as 别名]
# 或者: from PySide2.QtWidgets import QLabel [as 别名]
def __init__(self, parent, name, data):
if not type(data) == binaryninja.binaryview.BinaryView:
raise Exception('expected widget data to be a BinaryView')
self.bv = data
QWidget.__init__(self, parent)
DockContextHandler.__init__(self, self, name)
self.actionHandler = UIActionHandler()
self.actionHandler.setupActionHandler(self)
layout = QVBoxLayout()
self.consoleText = QTextEdit(self)
self.consoleText.setReadOnly(True)
self.consoleText.setFont(getMonospaceFont(self))
layout.addWidget(self.consoleText, 1)
inputLayout = QHBoxLayout()
inputLayout.setContentsMargins(4, 4, 4, 4)
promptLayout = QVBoxLayout()
promptLayout.setContentsMargins(0, 5, 0, 5)
inputLayout.addLayout(promptLayout)
self.consoleEntry = QLineEdit(self)
inputLayout.addWidget(self.consoleEntry, 1)
self.entryLabel = QLabel("dbg>>> ", self)
self.entryLabel.setFont(getMonospaceFont(self))
promptLayout.addWidget(self.entryLabel)
promptLayout.addStretch(1)
self.consoleEntry.returnPressed.connect(lambda: self.sendLine())
layout.addLayout(inputLayout)
layout.setContentsMargins(0, 0, 0, 0)
layout.setSpacing(0)
self.setLayout(layout)
示例8: build
# 需要导入模块: from PySide2 import QtWidgets [as 别名]
# 或者: from PySide2.QtWidgets import QLabel [as 别名]
def build(self):
self.setStyleSheet('QLabel {color: white}')
layout = QGridLayout()
self.setLayout(layout)
layout.setRowStretch(0, 10)
layout.setColumnStretch(3, 1)
key_lbl = QLabel('{} Hotkeys:'.format(self.mode.title()))
layout.addWidget(key_lbl, 1, 0, 1, 2)
position = 2
for key, op in self.mapping.iteritems():
key_lbl = QLabel(key)
layout.addWidget(key_lbl, position, 0, 1, 1)
op_lbl = QLabel(op)
layout.addWidget(op_lbl, position, 1, 1, 1)
position += 1
# help_key_lbl = QLabel('h')
# layout.addWidget(help_key_lbl, position, 0, 1, 1)
#
# help_lbl = QLabel('Toggle Help')
# layout.addWidget(help_lbl, position, 1, 1, 1)
layout.setRowStretch(position, 1)
示例9: build
# 需要导入模块: from PySide2 import QtWidgets [as 别名]
# 或者: from PySide2.QtWidgets import QLabel [as 别名]
def build(self):
layout = QGridLayout()
self.setLayout(layout)
lbl - QLabel('FOOOOOOO')
layout.addWidget(lbl)
示例10: initUI
# 需要导入模块: from PySide2 import QtWidgets [as 别名]
# 或者: from PySide2.QtWidgets import QLabel [as 别名]
def initUI(self):
grid = QtWidgets.QGridLayout()
#Create actions dictionary and group dictionary
self.atomActionGroup = QtWidgets.QActionGroup(self, exclusive=True)
self.atomActions = {}
#for atomname in self.editor.atomtypes.keys(): Gives unsorted list
for key in self.ptable.keys():
atomname = self.ptable[key]["Symbol"]
action = QtWidgets.QAction( '%s'%atomname,
self,
statusTip="Set atomtype to %s"%atomname,
triggered=self.atomtypePush, objectName=atomname,
checkable=True)
self.atomActionGroup.addAction(action)
self.atomActions[atomname] = action
if action.objectName() == "C":
action.setChecked(True)
button = QtWidgets.QToolButton()
button.setDefaultAction(action)
button.setFocusPolicy(QtCore.Qt.NoFocus)
button.setMaximumWidth(40)
if self.ptable[key]["Group"] != None:
grid.addWidget(button, self.ptable[key]["Period"], self.ptable[key]["Group"])
else:
if key <72:
grid.addWidget(button, 9, key-54)
else:
grid.addWidget(button, 10, key-86)
#Ensure spacing between main table and actinides/lathanides
grid.addWidget(QtWidgets.QLabel(''), 8,1)
self.setLayout(grid)
self.move(300, 150)
self.setWindowTitle('Periodic Table')
示例11: make_status_label
# 需要导入模块: from PySide2 import QtWidgets [as 别名]
# 或者: from PySide2.QtWidgets import QLabel [as 别名]
def make_status_label(self, text):
label = QtWidgets.QLabel(text)
label.setFrameStyle(QtWidgets.QLabel.Panel | QtWidgets.QLabel.Sunken)
self.status_bar.addPermanentWidget(label)
return label
示例12: __init__
# 需要导入模块: from PySide2 import QtWidgets [as 别名]
# 或者: from PySide2.QtWidgets import QLabel [as 别名]
def __init__(self, parent=None):
super(ShapeSettings, self).__init__(parent)
self.shape = QtWidgets.QComboBox()
self.shape.addItems(SHAPE_TYPES)
self.shape.currentIndexChanged.connect(self.shape_changed)
self.left = FloatEdit(minimum=0.0)
method = partial(self.rectModified.emit, 'shape.left')
self.left.valueSet.connect(method)
self.top = FloatEdit(minimum=0.0)
method = partial(self.rectModified.emit, 'shape.right')
self.top.valueSet.connect(method)
self.width = FloatEdit(minimum=0.0)
method = partial(self.rectModified.emit, 'shape.width')
self.width.valueSet.connect(method)
self.height = FloatEdit(minimum=0.0)
method = partial(self.rectModified.emit, 'shape.height')
self.height.valueSet.connect(method)
self.layout = QtWidgets.QFormLayout(self)
self.layout.setSpacing(0)
self.layout.setContentsMargins(0, 0, 0, 0)
self.layout.setHorizontalSpacing(5)
self.layout.addRow('Shape', self.shape)
self.layout.addItem(QtWidgets.QSpacerItem(0, 8))
self.layout.addRow(Title('Dimensions'))
self.layout.addRow('left', self.left)
self.layout.addRow('top', self.top)
self.layout.addRow('width', self.width)
self.layout.addRow('height', self.height)
for label in self.findChildren(QtWidgets.QLabel):
if not isinstance(label, Title):
label.setFixedWidth(LEFT_CELL_WIDTH)
示例13: __init__
# 需要导入模块: from PySide2 import QtWidgets [as 别名]
# 或者: from PySide2.QtWidgets import QLabel [as 别名]
def __init__(self):
super(ButtonAndLabel, self).__init__()
self.button = QPushButton("button")
self.button.clicked.connect(self.buttonClicked)
self.label = QLabel("label: before clicked")
layout = QVBoxLayout()
layout.addWidget(self.button)
layout.addWidget(self.label)
self.setLayout(layout)
开发者ID:PacktPublishing,项目名称:Hands-On-Blockchain-for-Python-Developers,代码行数:15,代码来源:button_and_label.py
示例14: __init__
# 需要导入模块: from PySide2 import QtWidgets [as 别名]
# 或者: from PySide2.QtWidgets import QLabel [as 别名]
def __init__(self):
super(ButtonAndDialog, self).__init__()
self.button = QPushButton("button")
self.button.clicked.connect(self.buttonClicked)
self.label = QLabel("")
layout = QVBoxLayout()
layout.addWidget(self.button)
layout.addWidget(self.label)
self.setLayout(layout)
开发者ID:PacktPublishing,项目名称:Hands-On-Blockchain-for-Python-Developers,代码行数:15,代码来源:button_and_dialog.py
示例15: buttonClicked
# 需要导入模块: from PySide2 import QtWidgets [as 别名]
# 或者: from PySide2.QtWidgets import QLabel [as 别名]
def buttonClicked(self):
self.index += 1
label = QLabel(str(self.index))
self.v_layout.addWidget(label)