728x90
반응형
import sys
from PySide2.QtWidgets import (QApplication, QWidget, QHBoxLayout,
QSpinBox, QSlider, QProgressBar)
from PySide2.QtCore import Qt
class MainWindow(QWidget):
def __init__(self, parent = None):
QWidget.__init__(self, parent)
self.spin = QSpinBox()
self.spin.setRange(0, 100)
self.slider = QSlider(Qt.Horizontal)
self.slider.setRange(0, 100)
self.progressBar = QProgressBar()
self.progressBar.setAlignment(Qt.AlignCenter)
self.progressBar.setRange(0, 100)
self.spin.valueChanged.connect(self.progressBar.setValue)
self.spin.valueChanged.connect(self.slider.setValue)
self.slider.valueChanged.connect(self.spin.setValue)
self.spin.valueChanged.connect(self.valueChanged)
layout = QHBoxLayout()
layout.addWidget(self.spin)
layout.addWidget(self.slider)
layout.addWidget(self.progressBar)
self.setLayout(layout)
self.setWindowTitle("Spin Slider progressBar Example")
def valueChanged(self, value):
print('valueChanged: value: ', value)
self.slider.setValue(value)
if __name__ == "__main__":
app = QApplication(sys.argv)
mainWindow = MainWindow()
mainWindow.show()
app.exec_()
pass
728x90
반응형
'Qt' 카테고리의 다른 글
serial_Write and Read (0) | 2022.11.04 |
---|---|
label (0) | 2022.11.04 |
test (0) | 2022.11.04 |
login (0) | 2022.11.04 |
QPushbutton exam.. (0) | 2022.11.03 |