title: menuBar() in PyQt5
body: <p>I am trying to load a menubar onto my gui, but my class object has no attribute for self.menuBar(). Can someone help me, no tutorials seem to offer any way around.</p>
  
  <pre><code>class EmailBlast(QtWidgets.QWidget):
      def __init__(self):
          super().__init__()
          bar = QtWidgets.menuBar() 
          file_menu = bar.addMenu('File')
          file_edit = bar.addMenu('Edit')        
  </code></pre>
  
  <p>Error message:</p>
  
  <pre><code>File "BasicEmail.py", line 84, in email_config
  self.ui = EmailBlast()
  File "BasicEmail.py", line 96, in __init__
  self.menuBar()
  AttributeError: 'EmailBlast' object has no attribute 'menuBar'
  </code></pre>
  
  <p>What am I missing here.</p>
  
  <p>Updated project:</p>
  
  <pre><code>class MainWindow(QtWidgets.QMainWindow):
  def __init__(self):
      super().__init__()
      self.email_blast_widget = EmailBlast()
      self.setCentralWidget(self.email_blast_widget)
      bar = self.menuBar()
      file_file = bar.addMenu('File')         
      file_edit = bar.addMenu('Edit') 
  
  class EmailBlast(QtWidgets.QWidget):
  def __init__(self):
      super().__init__()
      self.text_box = QtWidgets.QTextEdit(self)
      self.save_button = QtWidgets.QPushButton('Save')
      self.clear_button = QtWidgets.QPushButton('Clear')        
      self.open_button = QtWidgets.QPushButton('Open')        
      self.init_ui()
  </code></pre>