Form.resize(820, 454)
Form.setObjectName("Form")
historyLength=1800
self.graphicsView = PlotWidget(Form)
self.graphicsView.setGeometry(QtCore.QRect(10, 10, 261, 121))
self.graphicsView.setObjectName("graphicsView")
self.graphicsView.setLabel(axis="left",text='sEMG Voltage')
self.graphicsView.setLabel(axis='bottom',text='Time')
self.graphicsView.setMouseEnabled(x=False,y=False)
self.graphicsView.setAntialiasing(True)
self.graphicsView.enableMouse(False)
self.data1 = np.random.normal(size=1800)
self.curve2 = self.graphicsView.plot(self.data1)
self.ptr1 = 0
def update1():
global data1, ptr1
self.graphicsView.setRange(xRange=[self.ptr1,self.ptr1+historyLength],yRange=[0,500],padding=0)
self.data1[:-1] = self.data1[1:] # shift data in the array one sample left
self.data1[-1] = random.uniform(0,500)
self.ptr1 += 1
self.curve2.setData(self.data1)
self.curve2.setPos(self.ptr1, 0)
self.timer = pg.QtCore.QTimer()
self.timer.timeout.connect(update1)
self.timer.start(10)
设置了 buttonsHidden = True 还是去不掉
1
AlexShui 2022-03-30 18:33:49 +08:00 via Android
蹲一个
|
2
ALLROBOT OP @AlexShui #1
问题已解决,设置 self.graphicsView.setMouseEnabled(x=False,y=False) self.graphicsView.setAntialiasing(True) self.graphicsView.setMenuEnabled(False) 禁用右键菜单、拖动、左下角的 A 按钮 |
3
ALLROBOT OP 😅那个隐藏按钮是我搞错了用法,楼上给的解决方案: https://pyqtgraph.narkive.com/XzPRpre0/remove-the-a-auto-range-button
顺便一提,pyqt disigner ,pyuic 等 pyqt 工具都是 conda 虚拟环境 Script 路径下的,Pycharm 找不到说明文档 不知道怎么回事,刷新路径或手动添加 Script 路径也没用,有没靠谱的解决方案? |