Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import sys
- import PyQt4.QtGui as QtGui
- class Template:
- def __init__(self):
- app = QtGui.QApplication(sys.argv)
- self.gui()
- sys.exit(app.exec_())
- def doStuff(self):
- msg = QtGui.QMessageBox()
- msg.setText("doStuff()")
- msg.setDetailedText("doStuff()\r\nMethod Was Called...")
- msg.setIcon(2)
- msg.exec_()
- def gui(self):
- win = QtGui.QDialog()
- layout = QtGui.QGridLayout()
- layout.setSpacing(10)
- w = QtGui.QLabel("Qt4 Template")
- b = QtGui.QPushButton()
- b.setText("Click Me!")
- b.clicked.connect(self.doStuff)
- layout.addWidget(w,2,3,2,2)
- layout.addWidget(b,3,3,2,2)
- win.setWindowTitle("Qt4Template")
- win.setLayout(layout)
- win.setGeometry(100, 100, 200,100)
- win.exec_()
- if __name__ == '__main__':
- app = Template()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement