本文整理汇总了Python中matplotlib.backends.qt_compat.QtGui.QFont方法的典型用法代码示例。如果您正苦于以下问题:Python QtGui.QFont方法的具体用法?Python QtGui.QFont怎么用?Python QtGui.QFont使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类matplotlib.backends.qt_compat.QtGui
的用法示例。
在下文中一共展示了QtGui.QFont方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: tuple_to_qfont
# 需要导入模块: from matplotlib.backends.qt_compat import QtGui [as 别名]
# 或者: from matplotlib.backends.qt_compat.QtGui import QFont [as 别名]
def tuple_to_qfont(tup):
"""
Create a QFont from tuple:
(family [string], size [int], italic [bool], bold [bool])
"""
if not (isinstance(tup, tuple) and len(tup) == 4
and font_is_installed(tup[0])
and isinstance(tup[1], Integral)
and isinstance(tup[2], bool)
and isinstance(tup[3], bool)):
return None
font = QtGui.QFont()
family, size, italic, bold = tup
font.setFamily(family)
font.setPointSize(size)
font.setItalic(italic)
font.setBold(bold)
return font
示例2: tuple_to_qfont
# 需要导入模块: from matplotlib.backends.qt_compat import QtGui [as 别名]
# 或者: from matplotlib.backends.qt_compat.QtGui import QFont [as 别名]
def tuple_to_qfont(tup):
"""
Create a QFont from tuple:
(family [string], size [int], italic [bool], bold [bool])
"""
if not isinstance(tup, tuple) or len(tup) != 4 \
or not font_is_installed(tup[0]) \
or not isinstance(tup[1], int) \
or not isinstance(tup[2], bool) \
or not isinstance(tup[3], bool):
return None
font = QtGui.QFont()
family, size, italic, bold = tup
font.setFamily(family)
font.setPointSize(size)
font.setItalic(italic)
font.setBold(bold)
return font
示例3: tuple_to_qfont
# 需要导入模块: from matplotlib.backends.qt_compat import QtGui [as 别名]
# 或者: from matplotlib.backends.qt_compat.QtGui import QFont [as 别名]
def tuple_to_qfont(tup):
"""
Create a QFont from tuple:
(family [string], size [int], italic [bool], bold [bool])
"""
if not (isinstance(tup, tuple) and len(tup) == 4
and font_is_installed(tup[0])
and isinstance(tup[1], int)
and isinstance(tup[2], bool)
and isinstance(tup[3], bool)):
return None
font = QtGui.QFont()
family, size, italic, bold = tup
font.setFamily(family)
font.setPointSize(size)
font.setItalic(italic)
font.setBold(bold)
return font