Mar-30-2022, 12:59 PM
Hi,
I have window with buttons and some text and I need insert matplotlib below buttons.
Here is my code:
https://pasteboard.co/2IfAA0WyUAxX.jpg
I tried combine with this code, but I am totally lost. Thank you for help.
I have window with buttons and some text and I need insert matplotlib below buttons.
Here is my code:
import sys from PyQt6.QtCore import QSize, Qt from PyQt6.QtWidgets import QApplication, QMainWindow, QPushButton, QVBoxLayout, QCheckBox, QWidget, QLabel from matplotlib.backends.backend_qt5agg import FigureCanvasQTAgg as FigureCanvas from matplotlib.figure import Figure import matplotlib.pyplot as plt class AnotherWindow(QWidget): def __init__(self): super().__init__() layout = QVBoxLayout() self.setWindowTitle("MFR - Options") self.setMinimumSize(QSize(800, 400)) self.setLayout(layout) class MainWindow(QMainWindow): def button_TS_clicked(self): print("Time signal button clicked!") def button_FFT1500_clicked(self): print("FFT1500 button clicked!") def button_FFT7500_clicked(self): print("FFT7500 button clicked!") def button_hilbert_clicked(self): print("Hilbert button clicked!") def button_save_clicked(self): print("Save button clicked!") def button_options_clicked(self): self.dialog.exec_() def cb_update(self, state): if state == Qt.CheckState.Checked.value: print("AutoUpdate ON") else: print("AutoUpdate OFF") def options_window(self, checked): if self.window1.isVisible(): self.window1.hide() else: self.window1.show() def __init__(self): super().__init__() self.window1 = AnotherWindow() self.setWindowTitle("MFR") self.setMinimumSize(QSize(1024, 600)) button_TS = QPushButton("Time signal", self) button_TS.move(30,30) button_TS.clicked.connect(self.button_TS_clicked) button_FFT1500 = QPushButton("FFT 10-1500Hz", self) button_FFT1500.move(150,30) button_FFT1500.clicked.connect(self.button_FFT1500_clicked) button_FFT7500 = QPushButton("FFT 500-7500Hz", self) button_FFT7500.move(270,30) button_FFT7500.clicked.connect(self.button_FFT7500_clicked) button_hilbert = QPushButton("Hilbert", self) button_hilbert.move(390,30) button_hilbert.clicked.connect(self.button_hilbert_clicked) button_save = QPushButton("Save wav", self) button_save.move(510,30) button_save.clicked.connect(self.button_save_clicked) button_options = QPushButton("Options", self) button_options.move(630,30) button_options.clicked.connect(self.options_window) cb = QCheckBox("Auto Update", self) cb.move(750,30) cb.stateChanged.connect(self.cb_update) cb.toggle() cb.setChecked(False) self.label_1 = QLabel(self) self.label_1.move(30, 70) self.label_1.setText("SOME TEXTS.........................") app = QApplication(sys.argv) window = MainWindow() window.show() app.exec()I need it like this:
https://pasteboard.co/2IfAA0WyUAxX.jpg
I tried combine with this code, but I am totally lost. Thank you for help.