Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
PyQt + Matplotlib
#12
Thank you, I have made great progress.

I have inactive button as value indicator (I just like the style).
I defined button in buttonbox2:

class MainWindow(QtWidgets.QMainWindow):
    def __init__(self, *args, **kwargs):
        super(MainWindow, self).__init__(*args, **kwargs)
        self.canvas = MplCanvas(self, width=5, height=4, dpi=100)
        self.setCentralWidget(self.canvas)
        self.setMinimumSize(1024,600)   
        toolbar = NavigationToolbar(self.canvas, self)
        layout = QtWidgets.QVBoxLayout()
        buttonbox = QHBoxLayout()
        buttonbox2 = QHBoxLayout()

        btn7 = QPushButton("mm/s: 10.1")
        btn7.setEnabled(False)
        buttonbox2.addWidget(btn7)
Then I want change button text to peak value:

    def time_signal(self):
        serial_read()
        self.ydata = time_data
        self.canvas.axes.cla()  
        self.canvas.axes.plot(self.ydata[0:500], 'b')
        self.canvas.draw()

        btn7.settext(str(max(g_data)))   #----------------------------------------------------------
     
Is there any way how to change button text? I tried self.btn7, etc. etc. but no success.
Thank you
Reply


Messages In This Thread
PyQt + Matplotlib - by frohr - Mar-30-2022, 12:59 PM
RE: PyQt + Matplotlib - by Axel_Erfurt - Mar-30-2022, 04:26 PM
RE: PyQt + Matplotlib - by Axel_Erfurt - Mar-30-2022, 05:44 PM
RE: PyQt + Matplotlib - by frohr - Mar-30-2022, 06:05 PM
RE: PyQt + Matplotlib - by deanhystad - Mar-30-2022, 06:09 PM
RE: PyQt + Matplotlib - by Axel_Erfurt - Mar-30-2022, 06:57 PM
RE: PyQt + Matplotlib - by frohr - Mar-30-2022, 08:47 PM
RE: PyQt + Matplotlib - by Axel_Erfurt - Mar-30-2022, 09:19 PM
RE: PyQt + Matplotlib - by Axel_Erfurt - Mar-31-2022, 01:10 PM
RE: PyQt + Matplotlib - by frohr - Apr-01-2022, 11:39 AM
RE: PyQt + Matplotlib - by Axel_Erfurt - Apr-01-2022, 12:09 PM
RE: PyQt + Matplotlib - by frohr - Apr-02-2022, 06:19 PM
RE: PyQt + Matplotlib - by Axel_Erfurt - Apr-02-2022, 06:31 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Matplotlib: How do I convert Dates from Excel to use in Matplotlib JaneTan 1 3,323 Mar-11-2021, 10:52 AM
Last Post: buran

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020