from PyQt6 import QtWidgets, QtGui class plot_options_menu(QtWidgets.QMenu): def __init__(self, max_samples=1000): super().__init__() self.setTitle("Plot Settings") clear = QtGui.QAction("Clear graphs", self) self.addAction(clear) self.clear = clear self.samples_spinbox = QtWidgets.QSpinBox() self.samples_spinbox.setRange(2, 100000) self.samples_spinbox.setSuffix(" samples") self.samples_spinbox.setValue(max_samples) limit_samples = QtWidgets.QWidgetAction(self) limit_samples.setDefaultWidget(self.samples_spinbox) self.addAction(limit_samples) self.limit_samples = limit_samples