代码:
1 #coding: utf-8 2 import sys 3 from PyQt4.QtGui import * 4 from PyQt4.QtCore import * 5 6 7 class sigsort(QWidget): 8 def __init__(self, parent=None): 9 QWidget.__init__(self, parent) 10 11 self.setWindowTitle(self.tr("num")) 12 lcd = QLCDNumber(self) 13 slider = QSlider(Qt.Horizontal, self) 14 15 vbox = QVBoxLayout() 16 vbox.addWidget(lcd) 17 vbox.addWidget(slider) 18 19 self.setLayout(vbox) 20 self.connect(slider, SIGNAL('valueChanged(int)'), lcd, SLOT('display(int)')) 21 self.resize(250, 150) 22 app = QApplication(sys.argv) 23 qb = sigsort() 24 qb.show() 25 sys.exit(app.exec_())