Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import sys
- from PyQt4 import QtGui, QtCore
- class Example(QtGui.QWidget):
- def __init__(self):
- super(Example, self).__init__()
- self.initUI()
- def initUI(self):
- sld = QtGui.QSlider(QtCore.Qt.Horizontal, self)
- sld.setFocusPolicy(QtCore.Qt.NoFocus)
- sld.setGeometry(30, 40, 100, 30)
- sld.setTracking(False)
- sld.valueChanged[int].connect(self.changeValue)
- self.label = QtGui.QLabel(self)
- self.label.setPixmap(QtGui.QPixmap('mute.png'))
- self.label.setGeometry(160, 40, 80, 30)
- self.setGeometry(300, 300, 280, 170)
- self.setWindowTitle('QtGui.QSlider')
- self.show()
- def changeValue(self, value):
- print "changeValue called"
- confirm = QtGui.QMessageBox.question(self, "Save exam?",
- "You have not saved the exam data yet. Do you want to save the exam data before BOOM? All unsaved fields will be erased.",
- QtGui.QMessageBox.Save, QtGui.QMessageBox.Discard, QtGui.QMessageBox.Cancel)
- print "changeValue ended"
- def main():
- app = QtGui.QApplication(sys.argv)
- ex = Example()
- sys.exit(app.exec_())
- if __name__ == '__main__':
- main()
Advertisement
Add Comment
Please, Sign In to add comment