PyQt:eg4
2017-02-13 17:04 一方书斋 阅读(163) 评论(0) 编辑 收藏 举报import sys from PyQt4 import QtCore from PyQt4 import QtGui class Form(QtGui.QDialog): def __init__(self, parent=None): super(Form, self).__init__(parent) self.dial = QtGui.QDial() self.dial.setNotchesVisible(True) self.spinbox = QtGui.QSpinBox() self.layout = QtGui.QHBoxLayout() self.layout.addWidget(self.dial) self.layout.addWidget(self.spinbox) self.setLayout(self.layout) self.connect(self.dial, QtCore.SIGNAL("valueChanged(int)"), self.spinbox.setValue) self.connect(self.spinbox, QtCore.SIGNAL("valueChanged(int)"), self.dial.setValue) self.setWindowTitle("Signals and Slots") self.connect(self.dial, QtCore.SIGNAL("valueChanged(int)"), self.spinbox, QtCore.SLOT("setValue(int)")) self.connect(self.spinbox, QtCore.SIGNAL("valueChanged(int)"), self.dial, QtCore.SLOT("setValue(int)")) app = QtGui.QApplication(sys.argv) form = Form() form.show() app.exec_()