title: PyQT: how to open new window
body: <p>First of all, similar questions have been answered before, yet I need some help with this one.</p>
  
  <p>I have a window which contains one button <em>(Class First)</em> and I want on pressed, a second blank window to be appeared <em>(Class Second)</em>. </p>
  
  <p>I fiddled with the code copied from this question: <a href="https://stackoverflow.com/questions/14410152/pyqt-on-click-open-new-window">PyQT on click open new window</a>, and I wrote this code:</p>
  
  <pre><code># -*- coding: utf-8 -*-
  
  from PyQt4 import QtGui, QtCore
  import sys
  import design1, design2
  
  class Second(QtGui.QMainWindow, design2.Ui_MainWindow):
      def __init__(self, parent=None):
          super(Second, self).__init__(parent)
          self.setupUi(self)
  
  class First(QtGui.QMainWindow, design1.Ui_MainWindow):
      def __init__(self, parent=None):
          super(First, self).__init__(parent)
          self.setupUi(self)
  
          self.pushButton.clicked.connect(self.on_pushButton_clicked)
          self.dialog = Second(self)
  
      def on_pushButton_clicked(self):
          self.dialog.exec_()
  
  def main():
      app = QtGui.QApplication(sys.argv)
      main = First()
      main.show()
      sys.exit(app.exec_())
  
  if __name__ == '__main__':
      main()  
  </code></pre>
  
  <p>but on_pressed, this error message appears:</p>
  
  <pre><code>AttributeError: 'Second' object has no attribute 'exec_'
  </code></pre>
  
  <p><em>(design1 and design2 have been derived from the Qt designer.)</em> </p>
  
  <p>Any thought would be appreciated.</p>