I found the following tutorial https://www.pythonguis.com/widgets/pyqt-toggle-widget/ and was able to create a Toggle widget, but I don't know how to detect the value changes.
Can you please tell me how to detect toggle value change in below code:
import PyQt5
from PyQt5 import QtWidgets
from qtwidgets import Toggle, AnimatedToggle
class Window(QtWidgets.QMainWindow):
def __init__(self):
super().__init__()
toggle_1 = Toggle()
toggle_2 = AnimatedToggle(
checked_color="#FFB000",
pulse_checked_color="#44FFB000"
)
container = QtWidgets.QWidget()
layout = QtWidgets.QVBoxLayout()
layout.addWidget(toggle_1)
layout.addWidget(toggle_2)
container.setLayout(layout)
self.setCentralWidget(container)
app = QtWidgets.QApplication([])
w = Window()
w.show()
app.exec_()