PyQt4-Widget

# -*- coding: UTF-8 -*-
from PyQt4.QtGui import *
from PyQt4.QtCore import *
import sys

app = QApplication(sys.argv)
window = QWidget()
window.setWindowTitle('Enter Your Age')

spinBox = QSpinBox()
slider = QSlider(Qt.Horizontal)
spinBox.setRange(0, 130)
slider.setRange(0, 130)

QObject.connect(spinBox, SIGNAL('valueChanged(int)'), slider, SLOT('setValue(int)'))
QObject.connect(slider, SIGNAL('valueChanged(int)'), spinBox, SLOT('setValue(int)'))

spinBox.setValue(35)
layout = QHBoxLayout()
layout.addWidget(spinBox)
layout.addWidget(slider)
window.setLayout(layout)

window.show()

sys.exit(app.exec_())

你可能感兴趣的:(layout,import,Signal)