#!/usr/bin/python

import sys
from PyQt4 import QtGui
from PyQt4 import QtCore

class Example(QtGui.QWidget):
  def __init__(self):
    super(Example, self).__init__()
    self.initUI()

  def initUI(self):
    qbtn = QtGui.QPushButton('Quit', self)
    qbtn.clicked.connect(QtCore.QCoreApplication.instance().quit)
    qbtn.resize(qbtn.sizeHint())

    self.setGeometry(300, 300, 250, 150)
    self.setWindowTitle('Quit Button')
    self.show()

def main():
  app = QtGui.QApplication(sys.argv)
  ex = Example()
  sys.exit(app.exec_())


if __name__ == "__main__":
  main()


[((467, 495), 'PyQt4.QtGui.QApplication', 'QtGui.QApplication', (['sys.argv'], {}), '(sys.argv)\n', (485, 495), False, 'from PyQt4 import QtGui\n'), ((218, 249), 'PyQt4.QtGui.QPushButton', 'QtGui.QPushButton', (['"""Quit"""', 'self'], {}), "('Quit', self)\n", (235, 249), False, 'from PyQt4 import QtGui\n'), ((275, 309), 'PyQt4.QtCore.QCoreApplication.instance', 'QtCore.QCoreApplication.instance', ([], {}), '()\n', (307, 309), False, 'from PyQt4 import QtCore\n')]