本文整理汇总了Python中PyQt5.QtGui.QFont.Bold方法的典型用法代码示例。如果您正苦于以下问题:Python QFont.Bold方法的具体用法?Python QFont.Bold怎么用?Python QFont.Bold使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PyQt5.QtGui.QFont
的用法示例。
在下文中一共展示了QFont.Bold方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: format
# 需要导入模块: from PyQt5.QtGui import QFont [as 别名]
# 或者: from PyQt5.QtGui.QFont import Bold [as 别名]
def format(color, style=''):
"""Return a QTextCharFormat with the given attributes.
"""
_color = QColor()
_color.setNamedColor(color)
_format = QTextCharFormat()
_format.setForeground(_color)
if 'bold' in style:
_format.setFontWeight(QFont.Bold)
if 'italic' in style:
_format.setFontItalic(True)
return _format
# Syntax styles that can be shared by all languages
示例2: setDefaultSettings
# 需要导入模块: from PyQt5.QtGui import QFont [as 别名]
# 或者: from PyQt5.QtGui.QFont import Bold [as 别名]
def setDefaultSettings(self, lexer):
# self.setAutoIndent(True)
lexer.setFont(self.font)
lexer.setColor(QColor("white"), 0) # default
lexer.setColor(QColor("#6B6E6C"), PythonLexer.Comment) # = 1
lexer.setColor(QColor("#ADD4FF"), 2) # Number = 2
lexer.setColor(QColor("#38ef7d"), 3) # DoubleQuotedString
lexer.setColor(QColor("#38ef7d"), 4) # SingleQuotedString
lexer.setColor(QColor("#F6DC74"), 5) # Keyword
lexer.setColor(QColor("#38ef7d"), 6) # TripleSingleQuotedString
lexer.setColor(QColor("#38ef7d"), 7) # TripleDoubleQuotedString
lexer.setColor(QColor("#74F6C3"), 8) # ClassName
lexer.setColor(QColor("#FF6666"), 9) # FunctionMethodName
lexer.setColor(QColor("magenta"), 10) # Operator
lexer.setColor(QColor("white"), 11) # Identifier
lexer.setColor(QColor("gray"), 12) # CommentBlock
lexer.setColor(QColor("#a8ff78"), 13) # UnclosedString
lexer.setColor(QColor("gray"), 14) # HighlightedIdentifier
lexer.setColor(QColor("#FF00E7"), 15) # Decorator
lexer.setFont(QFont("Iosevka", weight=QFont.Bold), 5)
self.setCaretLineBackgroundColor(QColor("#3C3B3F"))
self.setLexer(lexer)
示例3: initUI
# 需要导入模块: from PyQt5.QtGui import QFont [as 别名]
# 或者: from PyQt5.QtGui.QFont import Bold [as 别名]
def initUI(self):
self.confirm_button = QPushButton()
self.headline = QFont("Arial", 10, QFont.Bold)
self.elementInfo = QLabel()
self.elementInfo.setFont(self.headline)
self.exceptionMessage = QTextEdit()
self.exceptionMessage.setReadOnly(True)
self.setMinimumSize(400, 300)
self.setWindowFlags(Qt.Window)
self.exceptWindowLayout = QVBoxLayout()
self.exceptWindowLayout.addWidget(self.elementInfo)
self.exceptWindowLayout.addWidget(self.exceptionMessage)
self.exceptWindowLayout.addStretch(1)
self.exceptWindowLayout.addWidget(self.confirm_button)
self.confirm_button.clicked.connect(self.close)
self.setLayout(self.exceptWindowLayout)
示例4: paint
# 需要导入模块: from PyQt5.QtGui import QFont [as 别名]
# 或者: from PyQt5.QtGui.QFont import Bold [as 别名]
def paint(self, painter, option, idx):
new_idx = idx.sibling(idx.row(), 0)
item = self.model.itemFromIndex(new_idx)
if item and item.data(Qt.UserRole) in self.added_node_list:
option.font.setWeight(QFont.Bold)
QStyledItemDelegate.paint(self, painter, option, idx)
示例5: format
# 需要导入模块: from PyQt5.QtGui import QFont [as 别名]
# 或者: from PyQt5.QtGui.QFont import Bold [as 别名]
def format(color, style=''):
"""Return a QTextCharFormat with the given attributes.
"""
_color = QColor()
_color.setNamedColor(color)
_format = QTextCharFormat()
_format.setForeground(_color)
if 'bold' in style:
_format.setFontWeight(QFont.Bold)
if 'italic' in style:
_format.setFontItalic(True)
return _format
示例6: format
# 需要导入模块: from PyQt5.QtGui import QFont [as 别名]
# 或者: from PyQt5.QtGui.QFont import Bold [as 别名]
def format(color, style=""):
"""Return a QTextCharFormat with the given attributes."""
_color = QColor()
_color.setNamedColor(color)
_format = QTextCharFormat()
_format.setForeground(_color)
if "bold" in style:
_format.setFontWeight(QFont.Bold)
if "italic" in style:
_format.setFontItalic(True)
return _format
# Syntax styles
示例7: showEvent
# 需要导入模块: from PyQt5.QtGui import QFont [as 别名]
# 或者: from PyQt5.QtGui.QFont import Bold [as 别名]
def showEvent(self, QShowEvent):
""" override to change font size when subtitle is cutted
"""
if len(self._sub_title.text()) * self._char_width > (
self._sub_title.width() - 155):
font = QFont('OpenSans', 14, QFont.Bold)
font.setPixelSize(20)
self._sub_title.setFont(font)
return super().showEvent(QShowEvent)
示例8: setup_ui
# 需要导入模块: from PyQt5.QtGui import QFont [as 别名]
# 或者: from PyQt5.QtGui.QFont import Bold [as 别名]
def setup_ui(self):
v_box = QVBoxLayout()
head = QHBoxLayout()
head.setContentsMargins(10, 10, 0, 10)
# dwarf icon
icon = QLabel()
icon.setPixmap(QPixmap(utils.resource_path('assets/dwarf.svg')))
icon.setAlignment(Qt.AlignCenter)
icon.setMinimumSize(QSize(125, 125))
icon.setMaximumSize(QSize(125, 125))
head.addWidget(icon)
# main title
v_box = QVBoxLayout()
title = QLabel('Dwarf')
title.setContentsMargins(0, 0, 0, 0)
title.setFont(QFont('Anton', 100, QFont.Bold))
title.setMaximumHeight(125)
title.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Minimum)
title.setAlignment(Qt.AlignVCenter | Qt.AlignLeft)
head.addWidget(title)
v_box.addLayout(head)
v_box.addWidget(QLabel('Copyright (C) 2019 Giovanni Rocca (iGio90)'))
v_box.addWidget(QLabel('Version: ' + DWARF_VERSION))
license_text = QTextEdit()
# replace tabbed
license_text.setText(self._gplv3.replace(' ', ''))
license_text.setReadOnly(True)
license_text.setMinimumWidth(550)
v_box.addWidget(license_text)
self.setLayout(v_box)
示例9: raiseWindow
# 需要导入模块: from PyQt5.QtGui import QFont [as 别名]
# 或者: from PyQt5.QtGui.QFont import Bold [as 别名]
def raiseWindow(self, filename):
logging.debug('StackWindow() called')
self.setMinimumSize(400, 300)
self.setWindowFlags(Qt.Window)
self.setWindowTitle(QC.translate('', 'Stack'))
self.confirm_button = QPushButton()
self.confirm_button.setText(QC.translate('', 'Ok'))
self.confirm_button.clicked.connect(self.close)
self.headline = QFont("Arial", 10, QFont.Bold)
self.info_string = QC.translate('', 'Debug info of element:')
self.elementInfo = QLabel()
self.elementInfo.setFont(self.headline)
self.elementInfoText = QC.translate('', 'Last update:')
self.elementInfoText += ' {}'.format(self.timestamp)
self.elementInfo.setText(self.elementInfoText)
# Will contain the QListWidgetItems
self.stackWidget = QListWidget()
try:
self.restock(filename)
except Exception as e:
logging.error('StackWindow::raiseWindow() exception while opening file: {}'.format(e))
self.closed.emit()
return
self.debugWindowLayout = QVBoxLayout()
self.debugWindowLayout.addWidget(self.elementInfo)
self.debugWindowLayout.addWidget(self.stackWidget)
self.debugWindowLayout.addWidget(self.confirm_button)
self.setLayout(self.debugWindowLayout)
self.show()
示例10: raiseWindow
# 需要导入模块: from PyQt5.QtGui import QFont [as 别名]
# 或者: from PyQt5.QtGui.QFont import Bold [as 别名]
def raiseWindow(self):
logging.debug('raiseWindow() called')
self.setMinimumSize(400, 300)
self.setWindowFlags(Qt.Window)
self.setWindowTitle(QC.translate('', 'Debug'))
self.setWindowModality(Qt.WindowModal)
self.confirm_button = QPushButton()
self.confirm_button.setText(QC.translate('', 'Ok'))
self.confirm_button.clicked.connect(self.close)
self.headline = QFont("Arial", 10, QFont.Bold)
self.info_string = QC.translate('', 'Debug info of element:')
self.elementInfo = QLabel()
self.elementInfo.setFont(self.headline)
self.elementInfo.setText(self.info_string + '{} {}'.format(self.source[0],
alphabet[self.source[1]]))
self.debugMessage = QTextEdit()
self.debugMessage.setReadOnly(True)
self.debugMessage.setText(self.message)
self.debugWindowLayout = QVBoxLayout()
self.debugWindowLayout.addWidget(self.elementInfo)
self.debugWindowLayout.addWidget(self.debugMessage)
self.debugWindowLayout.addStretch(1)
self.debugWindowLayout.addWidget(self.confirm_button)
self.setLayout(self.debugWindowLayout)
self.show()
示例11: set_slider
# 需要导入模块: from PyQt5.QtGui import QFont [as 别名]
# 或者: from PyQt5.QtGui.QFont import Bold [as 别名]
def set_slider(self):
self.slider = []
self.spin = []
self.label = []
for i in range(0, utils.M_NUM):
hbox = QtWidgets.QHBoxLayout()
slider = IndexedQSlider(i, QtCore.Qt.Horizontal, self)
slider.setStatusTip('%d. %s' % (i, utils.M_STR[i]))
slider.setRange(-30, 30)
slider.valueChangeForwarded.connect(
self.viewer3D.sliderForwardedValueChangeHandler)
slider.setFixedWidth(60)
self.slider.append(slider)
spinBox = QtWidgets.QSpinBox()
spinBox.setRange(-30, 30)
spinBox.valueChanged.connect(slider.setValue)
slider.valueChanged.connect(spinBox.setValue)
self.spin.append(spinBox)
label = QtWidgets.QLabel()
label.setText(utils.M_STR[i])
# label.setFont(QFont("Arial", 11, QFont.Bold))
label.setFont(QFont("Arial", 12))
label.setFixedWidth(190)
self.label.append(label)
hbox.addWidget(label)
hbox.addWidget(slider)
hbox.addWidget(spinBox)
self.box.addLayout(hbox)
示例12: set_dialog
# 需要导入模块: from PyQt5.QtGui import QFont [as 别名]
# 或者: from PyQt5.QtGui.QFont import Bold [as 别名]
def set_dialog(self):
self.pre_dialog = QtWidgets.QDialog()
self.dialogBox = QtWidgets.QVBoxLayout()
self.pre_dialog.setWindowTitle("Input")
self.editList = []
for i in range(0, utils.M_NUM):
edit = QtWidgets.QLineEdit()
self.editList.append(edit)
label = QtWidgets.QLabel()
if i == 0:
label.setText('{} (x2 kg)'.format(utils.M_STR[i]))
else:
label.setText('{} (cm)'.format(utils.M_STR[i]))
# label.setFont(QFont("Arial", 11, QFont.Bold))
label.setFont(QFont("Arial", 12))
label.setFixedHeight(20)
label.setFixedWidth(190)
box = QtWidgets.QHBoxLayout()
box.addWidget(label)
box.addWidget(edit)
self.dialogBox.addLayout(box)
dialogOK = QtWidgets.QPushButton("OK")
clearButton = QtWidgets.QPushButton("CLEAR")
dialogOK.setFont(QFont("Arial", 11, QFont.Bold))
clearButton.setFont(QFont("Arial", 11, QFont.Bold))
dialogOK.clicked.connect(self.predict)
clearButton.clicked.connect(self.clear)
box = QtWidgets.QHBoxLayout()
box.addWidget(dialogOK)
box.addWidget(clearButton)
self.dialogBox.addLayout(box)
self.pre_dialog.setLayout(self.dialogBox)
示例13: paint
# 需要导入模块: from PyQt5.QtGui import QFont [as 别名]
# 或者: from PyQt5.QtGui.QFont import Bold [as 别名]
def paint(self, painter: QPainter, option: QStyleOptionViewItem, index: QModelIndex) -> None:
r = option.rect
pencolor = Qt.white if self.theme == 'dark' else Qt.black
if self.parent.isEnabled():
if option.state & QStyle.State_Selected:
painter.setBrush(QColor(150, 190, 78, 150))
elif option.state & QStyle.State_MouseOver:
painter.setBrush(QColor(227, 212, 232))
pencolor = Qt.black
else:
brushcolor = QColor(79, 85, 87, 175) if self.theme == 'dark' else QColor('#EFF0F1')
painter.setBrush(Qt.transparent if index.row() % 2 == 0 else brushcolor)
painter.setPen(Qt.NoPen)
painter.drawRect(r)
thumbicon = QIcon(index.data(Qt.DecorationRole + 1))
starttime = index.data(Qt.DisplayRole + 1)
endtime = index.data(Qt.UserRole + 1)
externalPath = index.data(Qt.UserRole + 2)
chapterName = index.data(Qt.UserRole + 3)
painter.setPen(QPen(pencolor, 1, Qt.SolidLine))
if len(chapterName):
offset = 20
r = option.rect.adjusted(5, 5, 0, 0)
cfont = QFont('Futura LT', -1, QFont.Medium)
cfont.setPointSizeF(12.25 if sys.platform == 'darwin' else 10.25)
painter.setFont(cfont)
painter.drawText(r, Qt.AlignLeft, self.clipText(chapterName, painter, True))
r = option.rect.adjusted(5, offset, 0, 0)
else:
offset = 0
r = option.rect.adjusted(5, 0, 0, 0)
thumbicon.paint(painter, r, Qt.AlignVCenter | Qt.AlignLeft)
r = option.rect.adjusted(110, 10 + offset, 0, 0)
painter.setFont(QFont('Noto Sans', 11 if sys.platform == 'darwin' else 9, QFont.Bold))
painter.drawText(r, Qt.AlignLeft, 'FILENAME' if len(externalPath) else 'START')
r = option.rect.adjusted(110, 23 + offset, 0, 0)
painter.setFont(QFont('Noto Sans', 11 if sys.platform == 'darwin' else 9, QFont.Normal))
if len(externalPath):
painter.drawText(r, Qt.AlignLeft, self.clipText(os.path.basename(externalPath), painter))
else:
painter.drawText(r, Qt.AlignLeft, starttime)
if len(endtime) > 0:
r = option.rect.adjusted(110, 48 + offset, 0, 0)
painter.setFont(QFont('Noto Sans', 11 if sys.platform == 'darwin' else 9, QFont.Bold))
painter.drawText(r, Qt.AlignLeft, 'RUNTIME' if len(externalPath) else 'END')
r = option.rect.adjusted(110, 60 + offset, 0, 0)
painter.setFont(QFont('Noto Sans', 11 if sys.platform == 'darwin' else 9, QFont.Normal))
painter.drawText(r, Qt.AlignLeft, endtime)