Created
August 26, 2015 18:10
-
-
Save saleph/f4d39fd28534f2c9429c to your computer and use it in GitHub Desktop.
[qt5] slot & signal - slider
This file contains hidden or 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
| __author__ = 'tom' | |
| import sys | |
| from PyQt5.QtCore import Qt | |
| from PyQt5.QtWidgets import (QWidget, QLCDNumber, QSlider, | |
| QVBoxLayout, QApplication) | |
| class Example(QWidget): | |
| def __init__(self): | |
| super().__init__() | |
| self.init_ui() | |
| def init_ui(self): | |
| lcd = QLCDNumber(self) | |
| sld = QSlider(Qt.Horizontal, self) | |
| v_box = QVBoxLayout() | |
| v_box.addWidget(lcd) | |
| v_box.addWidget(sld) | |
| self.setLayout(v_box) | |
| sld.valueChanged.connect(lcd.display) | |
| self.setGeometry(300, 300, 250, 150) | |
| self.setWindowTitle('Signal & slot') | |
| self.show() | |
| if __name__ == "__main__": | |
| app = QApplication(sys.argv) | |
| ex = Example() | |
| sys.exit(app.exec_()) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment