Python 有没有办法锁定pyqtgraph ROI ScaleRotateHandle的特性?

Python 有没有办法锁定pyqtgraph ROI ScaleRotateHandle的特性?,python,pyqt5,pyqtgraph,roi,Python,Pyqt5,Pyqtgraph,Roi,我使用pyqtgraph ViewBox使用ImageItem类处理图像,并使用ROI类标记图像的重要部分。我正在处理的图像需要使用具有给定x和y像素大小的setAspectLocked 问题是,如果我在ViewBox上设置纵横比锁定,ROI比例旋转控制柄在旋转时会拉伸。有办法把它锁上吗?或者是否有一种方法仅在ImageItem类而不是整个ViewBox上应用setAspectLocked 下面有一个修改过的示例代码和我的问题。尝试旋转右侧的矩形 # -*- coding: utf-8 -*-

我使用pyqtgraph ViewBox使用ImageItem类处理图像,并使用ROI类标记图像的重要部分。我正在处理的图像需要使用具有给定x和y像素大小的setAspectLocked

问题是,如果我在ViewBox上设置纵横比锁定,ROI比例旋转控制柄在旋转时会拉伸。有办法把它锁上吗?或者是否有一种方法仅在ImageItem类而不是整个ViewBox上应用setAspectLocked

下面有一个修改过的示例代码和我的问题。尝试旋转右侧的矩形

# -*- coding: utf-8 -*-
import pyqtgraph as pg
from pyqtgraph.Qt import QtCore, QtGui
import numpy as np

pg.setConfigOptions(imageAxisOrder='row-major')


## create GUI
app = QtGui.QApplication([])
w = pg.GraphicsLayoutWidget(show=True, size=(1000,800), border=True)
w.setWindowTitle('pyqtgraph example: ROI Examples')

w3 = w.addLayout(row=1, col=0)
v3 = w3.addViewBox(row=1, col=0)
v3.setAspectLocked(True,1.8/18)

r3a = pg.ROI([0,0], [10,10])
v3.addItem(r3a)
## handles scaling horizontally around center
r3a.addScaleHandle([1, 0.5], [0.5, 0.5])
r3a.addScaleHandle([0, 0.5], [0.5, 0.5])

## handles scaling vertically from opposite edge
r3a.addScaleHandle([0.5, 0], [0.5, 1])
r3a.addScaleHandle([0.5, 1], [0.5, 0])

## handles scaling both vertically and horizontally
r3a.addScaleHandle([1, 1], [0, 0])
r3a.addScaleHandle([0, 0], [1, 1])

r3b = pg.ROI([20,0], [10,10])
v3.addItem(r3b)
## handles rotating around center
r3b.addRotateHandle([1, 1], [0.5, 0.5])
r3b.addRotateHandle([0, 0], [0.5, 0.5])

## handles rotating around opposite corner
r3b.addRotateHandle([1, 0], [0, 1])
r3b.addRotateHandle([0, 1], [1, 0])

## handles rotating/scaling around center
r3b.addScaleRotateHandle([0, 0.5], [0.5, 0.5])
r3b.addScaleRotateHandle([1, 0.5], [0.5, 0.5])

v3.disableAutoRange('xy')
v3.autoRange()

if __name__ == '__main__':
    import sys
    if (sys.flags.interactive != 1) or not hasattr(QtCore, 'PYQT_VERSION'):
        QtGui.QApplication.instance().exec_()