本文整理匯總了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])