本文整理汇总了Python中pyqtgraph.Qt.QtGui.QFont方法的典型用法代码示例。如果您正苦于以下问题:Python QtGui.QFont方法的具体用法?Python QtGui.QFont怎么用?Python QtGui.QFont使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pyqtgraph.Qt.QtGui
的用法示例。
在下文中一共展示了QtGui.QFont方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from pyqtgraph.Qt import QtGui [as 别名]
# 或者: from pyqtgraph.Qt.QtGui import QFont [as 别名]
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
self.setFixedSize(QtCore.QSize(600, 400))
w = QtGui.QWidget()
self.setCentralWidget(w)
vlayout = QtGui.QVBoxLayout()
w.setLayout(vlayout)
self.htmlView = QtWidgets.QTextBrowser(self)
font = QtGui.QFont()
font.setFamily('Arial')
self.htmlView.setReadOnly(True)
self.htmlView.setFont(font)
self.htmlView.setOpenExternalLinks(True)
self.htmlView.setObjectName('Help information')
html_help_path = get_source_name('docs/help.html')
ret = self.htmlView.setSource(QtCore.QUrl(html_help_path))
print('load result:', ret)
# self.htmlView.append(ret)
vlayout.addWidget(self.htmlView)
示例2: makePI
# 需要导入模块: from pyqtgraph.Qt import QtGui [as 别名]
# 或者: from pyqtgraph.Qt.QtGui import QFont [as 别名]
def makePI(self, name):
"""生成PlotItem对象"""
vb = CustomViewBox(self)
plotItem = pg.PlotItem(viewBox=vb, name=name, axisItems={'bottom': self.axisTime})
plotItem.setMenuEnabled(False)
# 仅绘制ViewBox可见范围内的点
plotItem.setClipToView(True)
plotItem.hideAxis('left')
plotItem.showAxis('right')
# 设置采样模式
plotItem.setDownsampling(mode='peak')
plotItem.setRange(xRange=(0, 1), yRange=(0, 1))
plotItem.getAxis('right').setWidth(70)
plotItem.getAxis('right').setStyle(tickFont=QtGui.QFont('Roman times', 10, QtGui.QFont.Bold))
plotItem.getAxis('right').setPen(color=(255, 255, 255, 255), width=0.8)
plotItem.showGrid(True, True)
plotItem.hideButtons()
return plotItem
示例3: createLabel
# 需要导入模块: from pyqtgraph.Qt import QtGui [as 别名]
# 或者: from pyqtgraph.Qt.QtGui import QFont [as 别名]
def createLabel(label, angle):
symbol = QtGui.QPainterPath()
#symbol.addText(0, 0, QFont("San Serif", 10), label)
f = QtGui.QFont()
f.setPointSize(10)
symbol.addText(0, 0, f, label)
br = symbol.boundingRect()
scale = min(1. / br.width(), 1. / br.height())
tr = QtGui.QTransform()
tr.scale(scale, scale)
tr.rotate(angle)
tr.translate(-br.x() - br.width()/2., -br.y() - br.height()/2.)
return TextSymbol(label, tr.map(symbol), 0.1 / scale)
示例4: __init__
# 需要导入模块: from pyqtgraph.Qt import QtGui [as 别名]
# 或者: from pyqtgraph.Qt.QtGui import QFont [as 别名]
def __init__(self, pos=None, text=None, color=None, font=QtGui.QFont()):
GLGraphicsItem.__init__(self)
self.color = color
if color is None:
self.color = QtCore.Qt.white
self.text = text
self.pos = pos
self.font = font
self.font.setPointSizeF(20)
示例5: __init__
# 需要导入模块: from pyqtgraph.Qt import QtGui [as 别名]
# 或者: from pyqtgraph.Qt.QtGui import QFont [as 别名]
def __init__(self, xdict, *args, **kwargs):
pg.AxisItem.__init__(self, *args, **kwargs)
self.minVal = 0
self.maxVal = 0
self.xdict = xdict
self.x_values = np.asarray(xdict.keys())
self.x_strings = xdict.values()
self.setPen(color=(255, 255, 255, 255), width=0.8)
self.setStyle(tickFont=QtGui.QFont("Roman times", 10, QtGui.QFont.Bold), autoExpandTextSpace=True)
# 更新坐标映射表
# ----------------------------------------------------------------------
示例6: update_buffer
# 需要导入模块: from pyqtgraph.Qt import QtGui [as 别名]
# 或者: from pyqtgraph.Qt.QtGui import QFont [as 别名]
def update_buffer(self, node, senders_shot):
if self.buffer_order.get(node) is None:
self.buffer_order[node] = self.buffer_index
self.buffer_labels.append(node)
text = pg.TextItem()
text.setText("P"+str(self.buffer_index))
text.setColor(self.QColors[self.buffer_index])
text.setFont(QtGui.QFont("arial", 16))
text.setPos(self.buffer_index, 1)
self.p4.addItem(text) # Add label for newly added peer
self.buffer_index += 1
senders_list = senders_shot.split(":")
buffer_order_node = self.buffer_order[node]
self.OutData[buffer_order_node].clear()
for pos, sender in enumerate(senders_list):
self.clear_all((buffer_order_node, pos)) # Clear previous color point, to avoid overapping
if sender != "":
ix = self.buffer_order[sender]
self.Data[ix].add((buffer_order_node, pos))
else:
self.OutData[buffer_order_node].add((buffer_order_node, pos))
######
xIn = []
yIn = []
for i in range(self.total_peers):
tempData = list(self.Data[i])
xIn.append([])
yIn.append([])
for pt in tempData:
xIn[i].append(pt[0])
yIn[i].append(pt[1])
xOut = []
yOut = []
for i in range(self.total_peers):
tempData = list(self.OutData[i])
for pt in tempData:
xOut.append(pt[0])
yOut.append(pt[1])
######
self.lineOUT.setData(x=xOut, y=yOut)
for ix in range(self.total_peers):
self.lineIN[ix].setData(x=xIn[ix], y=yIn[ix])