當前位置: 首頁>>代碼示例>>Python>>正文


Python QFont.Bold方法代碼示例

本文整理匯總了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 
開發者ID:andreafioraldi,項目名稱:IDAngr,代碼行數:19,代碼來源:syntax.py

示例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) 
開發者ID:CountryTk,項目名稱:Hydra,代碼行數:26,代碼來源:TextEditor.py

示例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) 
開發者ID:hANSIc99,項目名稱:Pythonic,代碼行數:26,代碼來源:exceptwindow.py

示例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) 
開發者ID:FreeOpcUa,項目名稱:opcua-modeler,代碼行數:8,代碼來源:uamodeler.py

示例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 
開發者ID:AirbusCyber,項目名稱:grap,代碼行數:16,代碼來源:QtGrapSyntax.py

示例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 
開發者ID:teemu-l,項目名稱:execution-trace-viewer,代碼行數:16,代碼來源:syntax_hl_log.py

示例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) 
開發者ID:iGio90,項目名稱:Dwarf,代碼行數:11,代碼來源:welcome_window.py

示例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) 
開發者ID:iGio90,項目名稱:Dwarf,代碼行數:36,代碼來源:about_dlg.py

示例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() 
開發者ID:hANSIc99,項目名稱:Pythonic,代碼行數:41,代碼來源:basic_stack_window.py

示例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() 
開發者ID:hANSIc99,項目名稱:Pythonic,代碼行數:37,代碼來源:debugwindow.py

示例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) 
開發者ID:1900zyh,項目名稱:3D-Human-Body-Shape,代碼行數:30,代碼來源:demo.py

示例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) 
開發者ID:1900zyh,項目名稱:3D-Human-Body-Shape,代碼行數:34,代碼來源:demo.py

示例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) 
開發者ID:ozmartian,項目名稱:vidcutter,代碼行數:50,代碼來源:videolist.py


注:本文中的PyQt5.QtGui.QFont.Bold方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。