本文整理汇总了Python中pyqtgraph.Qt.QtCore.QRectF方法的典型用法代码示例。如果您正苦于以下问题:Python QtCore.QRectF方法的具体用法?Python QtCore.QRectF怎么用?Python QtCore.QRectF使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pyqtgraph.Qt.QtCore
的用法示例。
在下文中一共展示了QtCore.QRectF方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: run
# 需要导入模块: from pyqtgraph.Qt import QtCore [as 别名]
# 或者: from pyqtgraph.Qt.QtCore import QRectF [as 别名]
def run(self):
app = QtGui.QApplication([])
## Create window with GraphicsView widget
win = pg.GraphicsLayoutWidget()
win.show() ## show widget alone in its own window
win.setWindowTitle('pyqtgraph example: ImageItem')
view = win.addViewBox()
## lock the aspect ratio so pixels are always square
view.setAspectLocked(True)
## Create image item
self.img = pg.ImageItem(border='w')
view.addItem(self.img)
## Set initial view bounds
view.setRange(QtCore.QRectF(0, 0, 2*self.image_hw, self.image_hw))
timer = QtCore.QTimer()
timer.timeout.connect(self._update)
timer.start(50)
app.exec_()
示例2: newColorbar
# 需要导入模块: from pyqtgraph.Qt import QtCore [as 别名]
# 或者: from pyqtgraph.Qt.QtCore import QRectF [as 别名]
def newColorbar(view, left, top, impixpervoxx, impixpervoxy, imgsize):
cb_xdim = imgsize // 10
cb_ydim = imgsize
theviewbox = pg.ViewBox(enableMouse=False)
theviewbox.setRange(QtCore.QRectF(0, 0, cb_xdim, cb_ydim),
xRange=(0, cb_xdim - 1), yRange=(0, cb_ydim - 1), padding=0.0,
disableAutoRange=True)
theviewbox.setAspectLocked()
thecolorbarwin = pg.ImageItem()
theviewbox.addItem(thecolorbarwin)
thecolorbarwin.translate(left, top)
thecolorbarwin.scale(impixpervoxx, impixpervoxy)
colorbarvals = np.zeros((cb_xdim, cb_ydim), dtype=np.float64)
for i in range(0, cb_ydim):
colorbarvals[:, i] = i * (1.0 / (cb_ydim - 1.0))
thecolorbarwin.setImage(colorbarvals, levels=[0.0, 1.0])
return thecolorbarwin, theviewbox
示例3: boundingRect
# 需要导入模块: from pyqtgraph.Qt import QtCore [as 别名]
# 或者: from pyqtgraph.Qt.QtCore import QRectF [as 别名]
def boundingRect(self):
return QtCore.QRectF()
示例4: mkPath
# 需要导入模块: from pyqtgraph.Qt import QtCore [as 别名]
# 或者: from pyqtgraph.Qt.QtCore import QRectF [as 别名]
def mkPath(self):
self.prepareGeometryChange()
r = self.r
d = self.d
h2 = d/2.
self.path = QtGui.QPainterPath()
if r == 0: ## flat surface
self.path.moveTo(0, h2)
self.path.lineTo(0, -h2)
else:
## half-height of surface can't be larger than radius
h2 = min(h2, abs(r))
#dx = abs(r) - (abs(r)**2 - abs(h2)**2)**0.5
#p.moveTo(-d*w/2.+ d*dx, d*h2)
arc = QtCore.QRectF(0, -r, r*2, r*2)
#self.surfaces.append((arc.center(), r, h2))
a1 = np.arcsin(h2/r) * 180. / np.pi
a2 = -2*a1
a1 += 180.
self.path.arcMoveTo(arc, a1)
self.path.arcTo(arc, a1, a2)
#if d == -1:
#p1 = QtGui.QPainterPath()
#p1.addRect(arc)
#self.paths.append(p1)
self.h2 = h2
示例5: boundingRect
# 需要导入模块: from pyqtgraph.Qt import QtCore [as 别名]
# 或者: from pyqtgraph.Qt.QtCore import QRectF [as 别名]
def boundingRect(self):
return QtCore.QRectF(0, 0, 20, 20)
示例6: __init__
# 需要导入模块: from pyqtgraph.Qt import QtCore [as 别名]
# 或者: from pyqtgraph.Qt.QtCore import QRectF [as 别名]
def __init__(self, clock):
pg.ItemGroup.__init__(self)
self.size = clock.size
self.item = QtGui.QGraphicsEllipseItem(QtCore.QRectF(0, 0, self.size, self.size))
self.item.translate(-self.size*0.5, -self.size*0.5)
self.item.setPen(pg.mkPen(100,100,100))
self.item.setBrush(clock.brush)
self.hand = QtGui.QGraphicsLineItem(0, 0, 0, self.size*0.5)
self.hand.setPen(pg.mkPen('w'))
self.hand.setZValue(10)
self.flare = QtGui.QGraphicsPolygonItem(QtGui.QPolygonF([
QtCore.QPointF(0, -self.size*0.25),
QtCore.QPointF(0, self.size*0.25),
QtCore.QPointF(self.size*1.5, 0),
QtCore.QPointF(0, -self.size*0.25),
]))
self.flare.setPen(pg.mkPen('y'))
self.flare.setBrush(pg.mkBrush(255,150,0))
self.flare.setZValue(-10)
self.addItem(self.hand)
self.addItem(self.item)
self.addItem(self.flare)
self.clock = clock
self.i = 1
self._spaceline = None
示例7: boundingRect
# 需要导入模块: from pyqtgraph.Qt import QtCore [as 别名]
# 或者: from pyqtgraph.Qt.QtCore import QRectF [as 别名]
def boundingRect(self):
return QtCore.QRectF(0, 0, 10, 10)
示例8: __init__
# 需要导入模块: from pyqtgraph.Qt import QtCore [as 别名]
# 或者: from pyqtgraph.Qt.QtCore import QRectF [as 别名]
def __init__(self, parent=None):
super(App, self).__init__(parent)
#### Create Gui Elements ###########
self.mainbox = QtGui.QWidget()
self.setCentralWidget(self.mainbox)
self.mainbox.setLayout(QtGui.QVBoxLayout())
self.canvas = pg.GraphicsLayoutWidget()
self.mainbox.layout().addWidget(self.canvas)
self.label = QtGui.QLabel()
self.mainbox.layout().addWidget(self.label)
self.view = self.canvas.addViewBox()
self.view.setAspectLocked(True)
self.view.setRange(QtCore.QRectF(0,0, 100, 100))
# image plot
self.img = pg.ImageItem(border='w')
self.view.addItem(self.img)
self.canvas.nextRow()
# line plot
self.otherplot = self.canvas.addPlot()
self.h2 = self.otherplot.plot(pen='y')
#### Set Data #####################
self.x = np.linspace(0,50., num=100)
self.X,self.Y = np.meshgrid(self.x,self.x)
self.counter = 0
self.fps = 0.
self.lastupdate = time.time()
#### Start #####################
self._update()
示例9: newViewWindow
# 需要导入模块: from pyqtgraph.Qt import QtCore [as 别名]
# 或者: from pyqtgraph.Qt.QtCore import QRectF [as 别名]
def newViewWindow(view, xdim, ydim, left, top, impixpervoxx, impixpervoxy, imgsize, enableMouse=False):
theviewbox = view.addViewBox(enableMouse=enableMouse, enableMenu=False, lockAspect=1.0)
theviewbox.setAspectLocked()
theviewbox.setRange(QtCore.QRectF(0, 0, imgsize, imgsize), padding=0., disableAutoRange=True)
theviewbox.setBackgroundColor([50, 50, 50])
theviewfgwin = pg.ImageItem()
theviewbox.addItem(theviewfgwin)
theviewfgwin.setZValue(10)
theviewfgwin.translate(left, top)
theviewfgwin.scale(impixpervoxx, impixpervoxy)
theviewbgwin = pg.ImageItem()
theviewbox.addItem(theviewbgwin)
theviewbgwin.setZValue(0)
theviewbgwin.translate(left, top)
theviewbgwin.scale(impixpervoxx, impixpervoxy)
theviewvLine = pg.InfiniteLine(angle=90, movable=False, pen='g')
theviewvLine.setZValue(20)
theviewbox.addItem(theviewvLine)
theviewhLine = pg.InfiniteLine(angle=0, movable=False, pen='g')
theviewhLine.setZValue(20)
theviewbox.addItem(theviewhLine)
return theviewfgwin, theviewbgwin, theviewvLine, theviewhLine, theviewbox