-
Notifications
You must be signed in to change notification settings - Fork 1
/
example.py
executable file
·31 lines (26 loc) · 908 Bytes
/
example.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
import sys
from PyQt5.QtWidgets import QApplication, QWidget, QFormLayout, QSpinBox, QTextEdit, QVBoxLayout, QLabel
from PyQt5.QtGui import *
from PyQt5.QtCore import *
class spindemo(QWidget):
def __init__(self, parent = None):
super(spindemo, self).__init__(parent)
layout = QVBoxLayout()
self.l1 = QLabel("current value:")
self.l1.setAlignment(Qt.AlignCenter)
layout.addWidget(self.l1)
self.sp = QSpinBox()
layout.addWidget(self.sp)
self.sp.valueChanged.connect(self.valuechange)
self.setLayout(layout)
self.setWindowTitle("SpinBox demo")
def valuechange(self):
print "hi"
self.l1.setText("current value:"+str(self.sp.value()))
def main():
app = QApplication(sys.argv)
ex = spindemo()
ex.show()
sys.exit(app.exec_())
if __name__ == '__main__':
main()