Skip to content

Instantly share code, notes, and snippets.

@ragnraok
Created October 30, 2012 06:03
Show Gist options
  • Save ragnraok/3978565 to your computer and use it in GitHub Desktop.
Save ragnraok/3978565 to your computer and use it in GitHub Desktop.
PyQt4SingalAndSlot
# -*- coding: utf8 -*-
import sys
from PyQt4.QtCore import *
from PyQt4.QtGui import *
class Form(QDialog):
def __init__(self, parent=None):
super(Form, self).__init__(parent)
dial = QDial()
dial.setNotchesVisible(True)
spinbox = QSpinBox()
layout = QHBoxLayout()
layout.addWidget(dial)
layout.addWidget(spinbox)
self.setLayout(layout)
self.connect(dial, SIGNAL("valueChanged(int)"),
spinbox, SLOT("setValue(int)"))
self.connect(spinbox, SIGNAL("valueChanged(int)"),
dial, SLOT("setValue(int)"))
self.setWindowTitle("SignalAndSlot")
app = QApplication(sys.argv)
form = Form()
form.show()
app.exec_()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment