Advertisement
Guest User

Untitled

a guest
Mar 24th, 2017
51
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.87 KB | None | 0 0
  1. import sys
  2. import PyQt4.QtGui as QtGui
  3.  
  4. class Template:
  5. def __init__(self):
  6. app = QtGui.QApplication(sys.argv)
  7. self.gui()
  8. sys.exit(app.exec_())
  9.  
  10. def doStuff(self):
  11. msg = QtGui.QMessageBox()
  12. msg.setText("doStuff()")
  13. msg.setDetailedText("doStuff()\r\nMethod Was Called...")
  14. msg.setIcon(2)
  15. msg.exec_()
  16.  
  17. def gui(self):
  18. win = QtGui.QDialog()
  19. layout = QtGui.QGridLayout()
  20. layout.setSpacing(10)
  21. w = QtGui.QLabel("Qt4 Template")
  22. b = QtGui.QPushButton()
  23. b.setText("Click Me!")
  24. b.clicked.connect(self.doStuff)
  25. layout.addWidget(w,2,3,2,2)
  26. layout.addWidget(b,3,3,2,2)
  27. win.setWindowTitle("Qt4Template")
  28. win.setLayout(layout)
  29. win.setGeometry(100, 100, 200,100)
  30. win.exec_()
  31.  
  32. if __name__ == '__main__':
  33. app = Template()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement