title: opening a new window
body: <p>I'm starting to learn OOP using PyQt5, so I'm trying to make a window with a button and when the button is clicked, I want to show a new window. I wrote this code but it doesn't work, it just shows the window with the button, but the button doesn't do anything, it seems like it just waits, but it doesn't give me any mistakes neither</p>
  
  <pre><code>import sys
  from PyQt5.QtWidgets import QApplication, QWidget, QPushButton, QVBoxLayout
  
  class Window2(QWidget):
      def __init__(self, parent=None):
          super(Window2, self).__init__(parent)
  
  
  class Window(QWidget):
      def __init__(self, parent=None):
          super(Window, self).__init__(parent)
  
          self.init_ui()
  
      def init_ui(self):
          self.btn = QPushButton("Push Me")
          layout = QVBoxLayout()
  
          layout.addWidget(self.btn)
  
          self.setLayout(layout)
          self.setWindowTitle("PyQt5 double window")
  
          self.btn.clicked.connect(self.btn_clk)
          self.newindow = Window2(self)
  
          self.show()
  
      def btn_clk(self):
          self.newindow.show()
  
  app = QApplication(sys.argv)
  a_window = Window()
  sys.exit(app.exec_())
  </code></pre>
  
  <p>This question guided me <a href="https://stackoverflow.com/questions/36768033/pyqt-how-to-open-new-window">PyQT: how to open new window</a> but it's written in PyQt4 and I'm not sure about the differences betweent these two.</p>