Last active
January 12, 2020 16:48
-
-
Save FloydanTheBeast/17248a04bdf95d75bebe2f7220fe3949 to your computer and use it in GitHub Desktop.
PyQt signals and slots example.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from PyQt5.QtWidgets import QApplication, QWidget, QVBoxLayout, QSlider, QProgressBar | |
from PyQt5.QtCore import Qt | |
app = QApplication([]) | |
window = QWidget() | |
layout = QVBoxLayout() | |
slider = QSlider(Qt.Horizontal) | |
progressBar = QProgressBar() | |
layout.addWidget(progressBar) | |
layout.addWidget(slider) | |
# slider.valueChanged - сигнал, progressBar.setValue - слот | |
slider.valueChanged.connect(progressBar.setValue) | |
window.setWindowTitle('Signal & slot') | |
window.setLayout(layout) | |
window.resize(300, 150) | |
window.show() | |
app.exec_() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment