Python PyQt5.QtGui.QFont() Examples
The following are 30
code examples of PyQt5.QtGui.QFont().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
PyQt5.QtGui
, or try the search function
.

Example #1
Source File: table.py From dunya-desktop with GNU General Public License v3.0 | 12 votes |
def __init__(self, parent=None): QTableView.__init__(self, parent=parent) # setting the table for no edit and row selection self.setEditTriggers(QAbstractItemView.NoEditTriggers) self.setSelectionBehavior(QAbstractItemView.SelectRows) # self.setSelectionMode(QtGui.QAbstractItemView.SingleSelection) self.setMouseTracking(True) self.horizontalHeader().setStretchLastSection(True) font = QFont() font.setPointSize(13) self.horizontalHeader().setFont(font) # hiding the vertical headers self.verticalHeader().hide() # arranging the artist column for being multi-line self.setWordWrap(True) self.setTextElideMode(Qt.ElideMiddle) self._last_index = QPersistentModelIndex() self.viewport().installEventFilter(self) self._set_font()
Example #2
Source File: Project.py From Python-GUI with MIT License | 11 votes |
def boxclose(self): teamname = self.open_screen.OpenTheTeam.text() myteam= sqlite3.connect('TEAM.db') curser= myteam.cursor() curser.execute("SELECT PLAYERS from team WHERE NAMES= '"+teamname+"';") hu= curser.fetchall() self.listWidget.clear() for i in range(len(hu)): item= QtWidgets.QListWidgetItem(hu[i][0]) font = QtGui.QFont() font.setBold(True) font.setWeight(75) item.setFont(font) item.setBackground(QtGui.QColor('sea green')) self.listWidget.addItem(item) self.openDialog.close()
Example #3
Source File: sourcewindow.py From dcc with Apache License 2.0 | 10 votes |
def _get_format_from_style(self, token, style): """ Returns a QTextCharFormat for token by reading a Pygments style. """ result = QtGui.QTextCharFormat() for key, value in list(style.style_for_token(token).items()): if value: if key == 'color': result.setForeground(self._get_brush(value)) elif key == 'bgcolor': result.setBackground(self._get_brush(value)) elif key == 'bold': result.setFontWeight(QtGui.QFont.Bold) elif key == 'italic': result.setFontItalic(True) elif key == 'underline': result.setUnderlineStyle( QtGui.QTextCharFormat.SingleUnderline) elif key == 'sans': result.setFontStyleHint(QtGui.QFont.SansSerif) elif key == 'roman': result.setFontStyleHint(QtGui.QFont.Times) elif key == 'mono': result.setFontStyleHint(QtGui.QFont.TypeWriter) return result
Example #4
Source File: Banners.py From qiew with GNU General Public License v2.0 | 10 votes |
def __init__(self, dataModel, viewMode): self.width = 0 self.height = 0 self.dataModel = dataModel self.viewMode = viewMode self.qpix = self._getNewPixmap(self.width, self.height) self.backgroundBrush = QtGui.QBrush(QtGui.QColor(0, 0, 128)) # text font self.font = QtGui.QFont('Terminus', 11, QtGui.QFont.Light) # font metrics. assume font is monospaced self.font.setKerning(False) self.font.setFixedPitch(True) fm = QtGui.QFontMetrics(self.font) self.fontWidth = fm.width('a') self.fontHeight = fm.height() self.textPen = QtGui.QPen(QtGui.QColor(192, 192, 192), 0, QtCore.Qt.SolidLine)
Example #5
Source File: Banners.py From qiew with GNU General Public License v2.0 | 9 votes |
def __init__(self, dataModel, viewMode): self.width = 0 self.height = 0 self.dataModel = dataModel self.viewMode = viewMode self.qpix = self._getNewPixmap(self.width, self.height) self.backgroundBrush = QtGui.QBrush(QtGui.QColor(0, 0, 128)) # text font self.font = QtGui.QFont('Consolas', 11, QtGui.QFont.Light) # font metrics. assume font is monospaced self.font.setKerning(False) self.font.setFixedPitch(True) fm = QtGui.QFontMetrics(self.font) self.fontWidth = fm.width('a') self.fontHeight = fm.height() self.textPen = QtGui.QPen(QtGui.QColor(255, 255, 0), 0, QtCore.Qt.SolidLine)
Example #6
Source File: Banners.py From qiew with GNU General Public License v2.0 | 9 votes |
def __init__(self, dataModel, viewMode): self.width = 0 self.height = 0 self.dataModel = dataModel self.viewMode = viewMode self.qpix = self._getNewPixmap(self.width, self.height) self.backgroundBrush = QtGui.QBrush(QtGui.QColor(0, 0, 128)) # text font self.font = QtGui.QFont('Terminus', 11, QtGui.QFont.Bold) # font metrics. assume font is monospaced self.font.setKerning(False) self.font.setFixedPitch(True) fm = QtGui.QFontMetrics(self.font) self.fontWidth = fm.width('a') self.fontHeight = fm.height() self.textPen = QtGui.QPen(QtGui.QColor(255, 255, 0), 0, QtCore.Qt.SolidLine)
Example #7
Source File: scorewidnow.py From Python-GUI with MIT License | 8 votes |
def setupUi(self, ScoreWindow): ScoreWindow.setObjectName("ScoreWindow") ScoreWindow.resize(471, 386) self.centralwidget = QtWidgets.QWidget(ScoreWindow) self.centralwidget.setObjectName("centralwidget") self.Score = QtWidgets.QLineEdit(self.centralwidget) self.Score.setGeometry(QtCore.QRect(180, 180, 113, 22)) self.Score.setObjectName("Score") self.teamscore = QtWidgets.QLabel(self.centralwidget) self.teamscore.setGeometry(QtCore.QRect(180, 130, 151, 20)) font = QtGui.QFont() font.setBold(True) font.setWeight(75) self.teamscore.setFont(font) self.teamscore.setObjectName("teamscore") ScoreWindow.setCentralWidget(self.centralwidget) self.statusbar = QtWidgets.QStatusBar(ScoreWindow) self.statusbar.setObjectName("statusbar") ScoreWindow.setStatusBar(self.statusbar) self.retranslateUi(ScoreWindow) QtCore.QMetaObject.connectSlotsByName(ScoreWindow)
Example #8
Source File: easygui_qt.py From easygui_qt with BSD 3-Clause "New" or "Revised" License | 7 votes |
def __init__(self): super(SimpleApp, self).__init__([]) self.translator = QtCore.QTranslator() self.default_font = QtGui.QFont() if sys.version_info < (3,) : settings_path = ".easygui-qt2" else: settings_path = ".easygui-qt3" self.config_path = os.path.join(os.path.expanduser("~"), settings_path) try: self.load_config() self.setFont(self.default_font) except: pass self.save_config()
Example #9
Source File: show_text_window.py From easygui_qt with BSD 3-Clause "New" or "Revised" License | 6 votes |
def __init__(self, parent=None): super(Highlighter, self).__init__(parent) keywordFormat = QtGui.QTextCharFormat() keywordFormat.setForeground(QtCore.Qt.blue) keywordFormat.setFontWeight(QtGui.QFont.Bold) keywordPatterns = ["\\b{}\\b".format(k) for k in keyword.kwlist] self.highlightingRules = [(QtCore.QRegExp(pattern), keywordFormat) for pattern in keywordPatterns] classFormat = QtGui.QTextCharFormat() classFormat.setFontWeight(QtGui.QFont.Bold) self.highlightingRules.append((QtCore.QRegExp("\\bQ[A-Za-z]+\\b"), classFormat)) singleLineCommentFormat = QtGui.QTextCharFormat() singleLineCommentFormat.setForeground(QtCore.Qt.gray) self.highlightingRules.append((QtCore.QRegExp("#[^\n]*"), singleLineCommentFormat)) quotationFormat = QtGui.QTextCharFormat() quotationFormat.setForeground(QtCore.Qt.darkGreen) self.highlightingRules.append((QtCore.QRegExp("\".*\""), quotationFormat)) self.highlightingRules.append((QtCore.QRegExp("'.*'"), quotationFormat))
Example #10
Source File: elf.py From qiew with GNU General Public License v2.0 | 6 votes |
def __init__(self, dataModel, viewMode, elfplugin): self.width = 0 self.height = 0 self.dataModel = dataModel self.viewMode = viewMode self.qpix = self._getNewPixmap(self.width, self.height) self.backgroundBrush = QtGui.QBrush(QtGui.QColor(0, 0, 128)) self.elfplugin = elfplugin self.elf = self.elfplugin.elf # text font self.font = QtGui.QFont('Terminus', 11, QtGui.QFont.Bold) # font metrics. assume font is monospaced self.font.setKerning(False) self.font.setFixedPitch(True) fm = QtGui.QFontMetrics(self.font) self.fontWidth = fm.width('a') self.fontHeight = fm.height() self.textPen = QtGui.QPen(QtGui.QColor(192, 192, 192), 0, QtCore.Qt.SolidLine)
Example #11
Source File: player.py From MusicBox with MIT License | 6 votes |
def __init__(self, parent=None): super(DesktopLyric, self).__init__() self.lyric = QString('Lyric Show.') self.intervel = 0 self.maskRect = QRectF(0, 0, 0, 0) self.maskWidth = 0 self.widthBlock = 0 self.t = QTimer() self.screen = QApplication.desktop().availableGeometry() self.setObjectName(_fromUtf8("Dialog")) self.setWindowFlags(Qt.CustomizeWindowHint | Qt.FramelessWindowHint | Qt.Dialog | Qt.WindowStaysOnTopHint | Qt.Tool) self.setMinimumHeight(65) self.setAttribute(Qt.WA_TranslucentBackground) self.handle = lyric_handle(self) self.verticalLayout = QVBoxLayout(self) self.verticalLayout.setSpacing(0) self.verticalLayout.setContentsMargins(0, 0, 0, 0) self.verticalLayout.setObjectName(_fromUtf8("verticalLayout")) self.font = QFont(_fromUtf8('微软雅黑, verdana'), 50) self.font.setPixelSize(50) # QMetaObject.connectSlotsByName(self) self.handle.lyricmoved.connect(self.newPos) self.t.timeout.connect(self.changeMask)
Example #12
Source File: uiutils.py From ddt4all with GNU General Public License v3.0 | 6 votes |
def getXMLFont(xml, scale = 1): font = getChildNodesByName(xml, "Font")[0] font_name = font.getAttribute("Name") font_size = float(font.getAttribute("Size").replace(',', '.')) font_bold = font.getAttribute("Bold") font_italic = font.getAttribute("Italic") if font_bold == '1': fnt_flags = gui.QFont.Bold else: fnt_flags = gui.QFont.Normal if font_italic == '1': fnt_flags |= gui.QFont.StyleItalic font_size = font_size / float(scale) * 14. qfnt = gui.QFont(font_name, font_size, fnt_flags) qfnt.setPixelSize(font_size) return qfnt
Example #13
Source File: uiutils.py From ddt4all with GNU General Public License v3.0 | 6 votes |
def jsonFont(fnt, scale): font_name = fnt['name'] font_size = fnt['size'] if 'bold' in fnt: font_bold = fnt['bold'] else: font_bold = '0' if 'italic' in fnt: font_italic = fnt['italic'] else: font_italic = '0' if font_bold == '1': fnt_flags = gui.QFont.Bold else: fnt_flags = gui.QFont.Normal if font_italic == '1': fnt_flags |= gui.QFont.StyleItalic font_size = font_size / float(scale) * 14. qfnt = gui.QFont(font_name, font_size, fnt_flags); qfnt.setPixelSize(font_size) return qfnt
Example #14
Source File: lrcwindow.py From QMusic with GNU Lesser General Public License v2.1 | 6 votes |
def initData(self): self._hovered = False self.linear_gradient = QLinearGradient() self.linear_gradient.setStart(0, 10) self.linear_gradient.setFinalStop(0, 40) self.linear_gradient.setColorAt(0.1, QColor(14, 179, 255)); self.linear_gradient.setColorAt(0.5, QColor(114, 232, 255)); self.linear_gradient.setColorAt(1, QColor(14, 179, 255)); self.mask_linear_gradient = QLinearGradient() self.mask_linear_gradient.setStart(0, 10) self.mask_linear_gradient.setFinalStop(0, 40) self.mask_linear_gradient.setColorAt(0.1, QColor(0, 100, 40)) self.mask_linear_gradient.setColorAt(0.5, QColor(0, 72, 16)) self.mask_linear_gradient.setColorAt(1, QColor(0, 255, 40)) self.text = "" self.percentage = 0 self.lyric_id = 0 self.line1_text = '' self.line1_percentage = 0 self.line2_text = '' self.line2_percentage = 0 self.lrcfont = QFont() self.lrcfont.setPixelSize(30) self.setFont(self.lrcfont) self._lineMode = 1
Example #15
Source File: globalmapwidget.py From PyPipboyApp with GNU General Public License v3.0 | 6 votes |
def __init__(self, widget, imageFactory, color, size, parent = None): super().__init__(widget.mapScene, widget.mapView, parent) self.markerType = 2 self.uid = 'powerarmormarker' self.widget = widget self.imageFactory = imageFactory self.imageFilePath = os.path.join('res', 'mapmarkerpowerarmor.svg') self.pipValueListenerDepth = 1 self.markerItem.setZValue(0) self.setColor(color,False) self.setSize(size,False) self.setLabelFont(QtGui.QFont("Times", 8, QtGui.QFont.Bold), False) self.setLabel('Power Armor', False) self.filterVisibleFlag = True self.PipVisible = False self.doUpdate()
Example #16
Source File: globalmapwidget.py From PyPipboyApp with GNU General Public License v3.0 | 6 votes |
def __init__(self, uid, widget, imageFactory, color, size, iconfile='mapmarkerpoi_1.svg', parent = None): super().__init__(widget.mapScene, widget.mapView, parent) self.markerType = 5 self.widget = widget self.imageFactory = imageFactory self.imageFilePath = iconfile self.pipValueListenerDepth = 1 self.markerItem.setZValue(0) self.setColor(color,False) self.setSize(size,False) self.setLabelFont(QtGui.QFont("Times", 8, QtGui.QFont.Bold), False) self.setLabel('Point of Interest Marker', False) self.filterVisibleFlag = True self.uid = str(uid) self.thisCharOnly = True self.doUpdate()
Example #17
Source File: globalmapwidget.py From PyPipboyApp with GNU General Public License v3.0 | 6 votes |
def __init__(self, uid, widget, imageFactory, color, size, parent = None, icon='StarFilled.svg'): super().__init__(widget.mapScene, widget.mapView, parent) self.markerType = 6 self.widget = widget self.imageFactory = imageFactory self.imageFilePath = os.path.join(icon) self.markerItem.setZValue(0) self.setColor(color,False) self.setSize(size, False) if self.color is not None: self.uncollectedColor = QtGui.QColor.fromRgb(self.color.red(), self.color.green(), self.color.blue()) self.collectedColor = self.color.darker(200) self.setLabelFont(QtGui.QFont("Times", 8, QtGui.QFont.Bold), False) self.setLabel('Collectable Marker', False) self.filterVisibleFlag = True self.uid = uid self.collected = False self.itemFormID = None self.collectedOverlayIcon = None self._rebuildOverlayIcons() self.doUpdate()
Example #18
Source File: sourcewindow.py From dcc with Apache License 2.0 | 5 votes |
def __init__(self, parent=None, lines=[]): super(SourceDocument, self).__init__(parent) self.parent = parent self.setDefaultFont(QtGui.QFont('Monaco', 9, QtGui.QFont.Light)) cursor = QtGui.QTextCursor(self) # position=0x0 self.binding = {} # save the cursor position before each interesting element for section, L in lines: for t in L: if t[0] in BINDINGS_NAMES: self.binding[cursor.position()] = t cursor.insertText(t[1])
Example #19
Source File: show_text_window.py From easygui_qt with BSD 3-Clause "New" or "Revised" License | 5 votes |
def set_text_font(self): font = QtGui.QFont() font.setFamily('Arial') font.setFixedPitch(False) font.setPointSize(12) self.editor.setFont(font)
Example #20
Source File: show_text_window.py From easygui_qt with BSD 3-Clause "New" or "Revised" License | 5 votes |
def set_monospace_font(self): font = QtGui.QFont() font.setFamily('Courier') font.setFixedPitch(True) font.setPointSize(12) self.editor.setFont(font)
Example #21
Source File: New.py From Python-GUI with MIT License | 5 votes |
def setupUi(self, Form): Form.setObjectName("Form") Form.resize(400, 300) self.label = QtWidgets.QLabel(Form) self.label.setGeometry(QtCore.QRect(100, 40, 201, 81)) font = QtGui.QFont() font.setPointSize(9) font.setBold(True) font.setWeight(75) self.label.setFont(font) self.label.setAlignment(QtCore.Qt.AlignCenter) self.label.setObjectName("label") self.pushButton = QtWidgets.QPushButton(Form) self.pushButton.setGeometry(QtCore.QRect(150, 190, 111, 28)) font = QtGui.QFont() font.setBold(True) font.setWeight(75) self.pushButton.setFont(font) self.pushButton.setObjectName("pushButton") self.lineEdit = QtWidgets.QLineEdit(Form) self.lineEdit.setGeometry(QtCore.QRect(100, 140, 201, 22)) self.lineEdit.setObjectName("lineEdit") self.retranslateUi(Form) QtCore.QMetaObject.connectSlotsByName(Form)
Example #22
Source File: Project.py From Python-GUI with MIT License | 5 votes |
def combo2(self): myteam=sqlite3.connect("TEAM.db") cu= myteam.cursor() team = self.eval_screen.SelectTeam.currentText() cu.execute("SELECT PlAYERS from team WHERE NAMES='"+team+"';") player= cu.fetchall() self.eval_screen.PlayerList.clear() for i in range(len(player)): item= QtWidgets.QListWidgetItem(player[i][0]) font = QtGui.QFont() font.setBold(True) font.setWeight(75) item.setFont(font) item.setBackground(QtGui.QColor('#ffff99')) self.eval_screen.PlayerList.addItem(item) cu.execute("SELECT SCORES from team WHERE NAMES='"+team+"';") score=cu.fetchall() self.teamscore=[] for i in range(len(score)): self.teamscore.append(score[i][0]) self.eval_screen.ScoreList.clear() for i in range(len(score)): items= QtWidgets.QListWidgetItem(str(score[i][0])) font = QtGui.QFont() font.setBold(True) font.setWeight(75) items.setFont(font) items.setBackground(QtGui.QColor('#fdc086')) self.eval_screen.ScoreList.addItem(items)
Example #23
Source File: mc_global.py From mindfulness-at-the-computer with GNU General Public License v3.0 | 5 votes |
def get_font_small(i_italics: bool=False, i_bold: bool=False) -> QtGui.QFont: font = QtGui.QFont() font.setPointSize(9) font.setItalic(i_italics) font.setBold(i_bold) return font
Example #24
Source File: mc_global.py From mindfulness-at-the-computer with GNU General Public License v3.0 | 5 votes |
def get_font_medium(i_italics: bool=False, i_bold: bool=False) -> QtGui.QFont: font = QtGui.QFont() font.setItalic(i_italics) font.setBold(i_bold) return font
Example #25
Source File: mc_global.py From mindfulness-at-the-computer with GNU General Public License v3.0 | 5 votes |
def get_font_large(i_underscore: bool=False, i_italics: bool=False, i_bold: bool=False) -> QtGui.QFont: font = QtGui.QFont() font.setPointSize(13) font.setUnderline(i_underscore) font.setItalic(i_italics) font.setBold(i_bold) return font
Example #26
Source File: mc_global.py From mindfulness-at-the-computer with GNU General Public License v3.0 | 5 votes |
def get_font_xlarge(i_underscore: bool=False, i_italics: bool=False, i_bold: bool=False) -> QtGui.QFont: font = QtGui.QFont() font.setPointSize(16) font.setUnderline(i_underscore) font.setItalic(i_italics) font.setBold(i_bold) return font
Example #27
Source File: mc_global.py From mindfulness-at-the-computer with GNU General Public License v3.0 | 5 votes |
def get_font_xxlarge(i_underscore: bool=False, i_italics: bool=False, i_bold: bool=False) -> QtGui.QFont: font = QtGui.QFont() font.setPointSize(24) font.setUnderline(i_underscore) font.setItalic(i_italics) font.setBold(i_bold) return font
Example #28
Source File: colorbar.py From screenshot with GNU General Public License v3.0 | 5 votes |
def initFontWidget(self): self.fontDialog = QFontDialog() self.changeFontButton = QPushButton(self) self.fontDialog.setCurrentFont(QFont('Sans serif')) self.changeFontButton.setText('{0} {1}'.format(self.fontDialog.currentFont().family(), self.fontDialog.currentFont().pointSize())) self.changeFontButton.clicked.connect(self.fontButtonClicked)
Example #29
Source File: WaveformDialog.py From pyweed with GNU Lesser General Public License v3.0 | 5 votes |
def __init__(self, value): super(KeepIndicatorTableWidgetItem, self).__init__() self.setKeep(value) # Use a large font size for the checkboxes font = QtGui.QFont() font.setPointSize(self.fontSize) self.setFont(font)
Example #30
Source File: FlowchartTemplate_pyqt5.py From tf-pose with Apache License 2.0 | 5 votes |
def setupUi(self, Form): Form.setObjectName("Form") Form.resize(529, 329) self.selInfoWidget = QtWidgets.QWidget(Form) self.selInfoWidget.setGeometry(QtCore.QRect(260, 10, 264, 222)) self.selInfoWidget.setObjectName("selInfoWidget") self.gridLayout = QtWidgets.QGridLayout(self.selInfoWidget) self.gridLayout.setContentsMargins(0, 0, 0, 0) self.gridLayout.setObjectName("gridLayout") self.selDescLabel = QtWidgets.QLabel(self.selInfoWidget) self.selDescLabel.setText("") self.selDescLabel.setAlignment(QtCore.Qt.AlignLeading|QtCore.Qt.AlignLeft|QtCore.Qt.AlignTop) self.selDescLabel.setWordWrap(True) self.selDescLabel.setObjectName("selDescLabel") self.gridLayout.addWidget(self.selDescLabel, 0, 0, 1, 1) self.selNameLabel = QtWidgets.QLabel(self.selInfoWidget) font = QtGui.QFont() font.setBold(True) font.setWeight(75) self.selNameLabel.setFont(font) self.selNameLabel.setText("") self.selNameLabel.setObjectName("selNameLabel") self.gridLayout.addWidget(self.selNameLabel, 0, 1, 1, 1) self.selectedTree = DataTreeWidget(self.selInfoWidget) self.selectedTree.setObjectName("selectedTree") self.selectedTree.headerItem().setText(0, "1") self.gridLayout.addWidget(self.selectedTree, 1, 0, 1, 2) self.hoverText = QtWidgets.QTextEdit(Form) self.hoverText.setGeometry(QtCore.QRect(0, 240, 521, 81)) self.hoverText.setObjectName("hoverText") self.view = FlowchartGraphicsView(Form) self.view.setGeometry(QtCore.QRect(0, 0, 256, 192)) self.view.setObjectName("view") self.retranslateUi(Form) QtCore.QMetaObject.connectSlotsByName(Form)