title: Update a QLabel , using a QPushButton in a QDialog
body: <p>I am just started to use the PyQt5 and I am trying to update the information of a label, through a button that is inside a subclass (QDialog). When I push the button, the program stop and show the message: </p>
  
  <pre><code>"AttributeError: 'New_Player_Window' object has no attribute 'name_window_label'
  </code></pre>
  
  <p>The idea is that when the Button is pressed, the Qlabel that by default is "Anonimous" become the Name of the User.</p>
  
  <p>The code is:</p>
  
  <pre><code>from PyQt5 import QtGui, QtWidgets
  from PyQt5.QtWidgets import QApplication, QMainWindow, QVBoxLayout, 
  QLineEdit, QLabel, QWidget, QPushButton, QMessageBox, QAction, QMenu, 
  QDialog
  import sys
  
  class General_Window(QMainWindow):
    def __init__(self):
      super().__init__()
      self.initUI()
    def initUI(self):
      self.resize(500, 500)
      self.move(300, 100)
      self.setWindowTitle('Black Jack')
      #MENUBAR
      menubar = self.menuBar()
      fileMenu = menubar.addMenu('File')
      newAct = QAction('New Player', self)
      newAct.triggered.connect(General_Window.new_player)
      fileMenu.addAction(newAct)
      #LABEL
      self.name_window_label = QLabel('Anonimous', self)
      self.name_window_label.move(245, 15)
      self.show()
  
    def update_window(self, value):
      print(str(value))
      self.name_window_label.setText(str(value))
  
    def new_player(self):
      class New_Player_Window(QDialog, General_Window):
          def __init__(self):
              super().__init__()
              self.initUI()
  
          def create(self):
              try:
                  int(self.money.text()) + 2
              except:
                  QMessageBox.question(self, 'PyQt5 message', "You need to 
                  insert a Number", QMessageBox.Ok , QMessageBox.Ok) 
              else:
                  global value
                  value = self.name.text()
                  print(value)
                  self.update_window(value)
  
          def initUI(self):                   
              self.setGeometry(300, 230, 250, 120)
              self.setWindowTitle('User Information')    
              #TEXTBOX1
              self.name = QLineEdit(self)
              self.name.move(110, 5)
              self.name.resize(110,20)
              #TEXTBOX2
              self.money = QLineEdit(self)
              self.money.move(110, 40)
              self.money.resize(110,20)
              #BUTTON1
              self.button = QPushButton('Create', self)
              self.button.move(5,80)
              self.button.clicked.connect(self.create)
              #BUTTON2
              self.button2 = QPushButton('Cancel', self)
              self.button2.move(120,80)
              #LABELNAME
              self.name_label = QLabel('SHORT NAME', self)
              self.name_label.move(20,10)
              #LABELNAME
              self.money_label = QLabel('MONEY AVAILABLE', self)
              self.money_label.move(10,45)
  
              self.show()
              self.exec_()
  
  
      if __name__=="__main__":
          New_Player_Window()
  
  if __name__=="__main__":
   app = QApplication(sys.argv)
   ag = General_Window()  
   sys.exit(app.exec_())
  </code></pre>