V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
推荐学习书目
Learn Python the Hard Way
Python Sites
PyPI - Python Package Index
http://diveintopython.org/toc/index.html
Pocoo
值得关注的项目
PyPy
Celery
Jinja2
Read the Docs
gevent
pyenv
virtualenv
Stackless Python
Beautiful Soup
结巴中文分词
Green Unicorn
Sentry
Shovel
Pyflakes
pytest
Python 编程
pep8 Checker
Styles
PEP 8
Google Python Style Guide
Code Style from The Hitchhiker's Guide
ALLROBOT
V2EX  ›  Python

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

  •  
  •   ALLROBOT · 2022-03-30 17:50:38 +08:00 · 1785 次点击
    这是一个创建于 751 天前的主题,其中的信息可能已经有所发展或是发生改变。

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

    3 条回复    2022-03-30 19:10:03 +08:00
    AlexShui
        1
    AlexShui  
       2022-03-30 18:33:49 +08:00 via Android
    蹲一个
    ALLROBOT
        2
    ALLROBOT  
    OP
       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
        3
    ALLROBOT  
    OP
       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 路径也没用,有没靠谱的解决方案?
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   2917 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 24ms · UTC 03:49 · PVG 11:49 · LAX 20:49 · JFK 23:49
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.