Pyqtgraph 绘制曲线的左下角的 A 按钮怎么去掉?

2022-03-30 17:50:38 +08:00
 ALLROBOT

        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 还是去不掉

1797 次点击
所在节点    Python
3 条回复
AlexShui
2022-03-30 18:33:49 +08:00
蹲一个
ALLROBOT
2022-03-30 19:03:43 +08:00
@AlexShui #1

问题已解决,设置
self.graphicsView.setMouseEnabled(x=False,y=False)
self.graphicsView.setAntialiasing(True)
self.graphicsView.setMenuEnabled(False)

禁用右键菜单、拖动、左下角的 A 按钮
ALLROBOT
2022-03-30 19:10:03 +08:00
😅那个隐藏按钮是我搞错了用法,楼上给的解决方案: https://pyqtgraph.narkive.com/XzPRpre0/remove-the-a-auto-range-button

顺便一提,pyqt disigner ,pyuic 等 pyqt 工具都是 conda 虚拟环境 Script 路径下的,Pycharm 找不到说明文档


不知道怎么回事,刷新路径或手动添加 Script 路径也没用,有没靠谱的解决方案?

这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。

https://www.v2ex.com/t/843926

V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。

V2EX is a community of developers, designers and creative people.

© 2021 V2EX