title: How can I self hide and show QDialog() in PyQT5?
body: <p>I have a GUI that was generated using Qt Designer, I used pyuic5 to generate a .py file. In a separate py (program.py) file I import my UI a do all my work there. </p>
  
  <p><strong>program.py</strong></p>
  
  <pre><code>import sys, os, time
  from subprocess import call
  from PyQt5 import QtCore, QtGui, QtWidgets
  from PyQt5.QtWidgets import *
  from PyQt5.QtGui import *
  from PyCred_GUI import Ui_Dialog
  
  
  class MyGUI(Ui_Dialog):
      def __init__(self, dialog):
          Ui_Dialog.__init__(self)
          self.setupUi(dialog)
  
  
          self.pushButton_2.clicked.connect(self.cancelbutton)
  
      def cancelbutton(self):
          exit()
  
  
  if __name__ == '__main__':
      app = QtWidgets.QApplication(sys.argv)
      dialog = QtWidgets.QDialog()
      dialog.setWindowFlags(QtCore.Qt.WindowSystemMenuHint)
      prog = MyGUI(dialog)
  
      dialog.show()
      sys.exit(app.exec_())
  </code></pre>
  
  <p>I pulled a lot out just to focus on the issue here. When I click my Cancel button, I want the window to hide, set a timer, and then reappear after so many seconds. I have tried every combination of self.close() self.hide() self.destroy() and none of them hide my window. I get an error that says</p>
  
  <p>"<strong>AttributeError: 'MyGUI' object has no attribute 'hide'</strong>"</p>
  
  <p>Which makes sense because MyGUI doesn't have a hide() function. I am at a complete loss on how to hide this window.</p>
  
  <p><strong>EDIT</strong> (Solved)
  For future people, as suggested by <a href="https://stackoverflow.com/users/1841194/hi-im-frogatto">Hi Im Frogatto</a> dialog.hide() worked. </p>