Guest User

Untitled

a guest
May 21st, 2018
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.76 KB | None | 0 0
  1. import sys
  2. from PyQt4 import QtGui, QtCore
  3.  
  4.  
  5. class Example(QtGui.QWidget):
  6.  
  7. def __init__(self):
  8. super(Example, self).__init__()
  9.  
  10. self.initUI()
  11.  
  12. def initUI(self):
  13.  
  14. btn = QtGui.QPushButton(self)
  15.  
  16. vbox = QtGui.QVBoxLayout()
  17. vbox.addWidget(btn)
  18.  
  19. self.setLayout(vbox)
  20.  
  21. QtCore.QObject.connect(btn, QtCore.SIGNAL("clicked()"), self.revealButton)
  22.  
  23. self.setGeometry(300, 300, 250, 150)
  24. self.setWindowTitle('Signal & slot')
  25. self.show()
  26.  
  27. def revealButton(self):
  28. print("kuku")
  29.  
  30. def main():
  31.  
  32. app = QtGui.QApplication(sys.argv)
  33. ex = Example()
  34. sys.exit(app.exec_())
  35.  
  36.  
  37. if __name__ == '__main__':
  38. main()
Add Comment
Please, Sign In to add comment