title: How to solve this error "object has no attribute"
body: <blockquote>
    <p>error: self.START.clicked.connect(self.StartClicked)</p>
    
    <blockquote>
      <p>AttributeError: 'code' object has no attribute 'StartClicked'</p>
    </blockquote>
  </blockquote>
  
  <p>Here is my code.
  I don't know where I am wrong in this code can you please check it and correct me where I am wrong.</p>
  
  <p>When I try to run the code without the GUI it works fine, but with QT it is giving me this error.</p>
  
  <pre><code>import sys
  import cv2
  import datetime
  
  from PyQt5.QtWidgets import QApplication ,QDialog
  from PyQt5.uic import loadUi
  from PyQt5.QtGui import QImage,QPixmap
  from PyQt5.QtCore import pyqtSlot
  
  
  class code(QDialog):
     def __init__(self):
          super(code,self).__init__()
          loadUi('letst.ui',self)
          self.logic =0
  
          self.START.clicked.connect(self.StartClicked)
          self.STOP.clicked.connect(self.StopClicked)
  @pyqtSlot()
  def StartClicked(self):
  
          self.logic=1
          fourcc = cv2.VideoWriter_fourcc(*'XVID')
          date=datetime.datetime.now()
          cap = cv2.VideoCapture(1)
          out= cv2.VideoWriter('E:/project/videos/rec_%s%s%s%s%s%s.mp4' %(date.year,date.month,date.day,date.hour,date.minute,date.second),fourcc,20.0,(640,480))
  
  
          while (cap.isOpened()):
  
                  ret,frame = cap.read()
                  if ret == True:
                          self.displayImage(frame,1)
                          cv2.waitKey()
  
                          if  (self.logic==1):
                                  out.write(frame)
                          if (self.logic==0):
                                  break
                  else:
                      print('return not found')
                  cap.release()
                  out.release()
                  cv2.destroyAllWindows()
  
  def StopClicked(self):
      self.logic=0
  def displayImage(self, img,window=1):
      qformat = QImage.Format_Indexed8
  
      if len(img.shape)==3:
          if (img.shape[2])==4:
              qformat=QImage.Format_RGBA888
  
          else:
              qformat=QImage.Format_RGB888
      img =QImage(img, img.shape[1],img.shape[0],qformat)
      img =img.rgbSwapped()
      self.imglabel.setPixmap(QPixmap.fromImage(img))
      self.imgLabel.setAlignment(QtCore.Qt.AlignHCenter | Qtcore.Qt.AlignVCenter)
  
  app=QApplication(sys.argv)
  Window = code()
  Window.show()
  try:
      sys.exit(app.exec_())
  except:
      print("exiting")
  
  </code></pre>
  
  <p>Here is the ui file:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;ui version="4.0"&gt;
   &lt;class&gt;Dialog&lt;/class&gt;
   &lt;widget class="QDialog" name="Dialog"&gt;
    &lt;property name="geometry"&gt;
     &lt;rect&gt;
      &lt;x&gt;0&lt;/x&gt;
      &lt;y&gt;0&lt;/y&gt;
      &lt;width&gt;780&lt;/width&gt;
      &lt;height&gt;555&lt;/height&gt;
     &lt;/rect&gt;
    &lt;/property&gt;
    &lt;property name="windowTitle"&gt;
     &lt;string&gt;Dialog&lt;/string&gt;
    &lt;/property&gt;
    &lt;widget class="QLabel" name="imgLabel"&gt;
     &lt;property name="geometry"&gt;
      &lt;rect&gt;
       &lt;x&gt;30&lt;/x&gt;
       &lt;y&gt;30&lt;/y&gt;
       &lt;width&gt;711&lt;/width&gt;
       &lt;height&gt;421&lt;/height&gt;
      &lt;/rect&gt;
     &lt;/property&gt;
     &lt;property name="frameShape"&gt;
      &lt;enum&gt;QFrame::WinPanel&lt;/enum&gt;
     &lt;/property&gt;
     &lt;property name="frameShadow"&gt;
      &lt;enum&gt;QFrame::Plain&lt;/enum&gt;
     &lt;/property&gt;
     &lt;property name="text"&gt;
      &lt;string/&gt;
     &lt;/property&gt;
    &lt;/widget&gt;
    &lt;widget class="QPushButton" name="START"&gt;
     &lt;property name="geometry"&gt;
      &lt;rect&gt;
       &lt;x&gt;40&lt;/x&gt;
       &lt;y&gt;490&lt;/y&gt;
       &lt;width&gt;101&lt;/width&gt;
       &lt;height&gt;51&lt;/height&gt;
      &lt;/rect&gt;
     &lt;/property&gt;
     &lt;property name="font"&gt;
      &lt;font&gt;
       &lt;pointsize&gt;16&lt;/pointsize&gt;
      &lt;/font&gt;
     &lt;/property&gt;
     &lt;property name="text"&gt;
      &lt;string&gt;start&lt;/string&gt;
     &lt;/property&gt;
    &lt;/widget&gt;
    &lt;widget class="QPushButton" name="STOP"&gt;
     &lt;property name="geometry"&gt;
      &lt;rect&gt;
       &lt;x&gt;180&lt;/x&gt;
       &lt;y&gt;490&lt;/y&gt;
       &lt;width&gt;101&lt;/width&gt;
       &lt;height&gt;51&lt;/height&gt;
      &lt;/rect&gt;
     &lt;/property&gt;
     &lt;property name="font"&gt;
      &lt;font&gt;
       &lt;pointsize&gt;16&lt;/pointsize&gt;
      &lt;/font&gt;
     &lt;/property&gt;
     &lt;property name="text"&gt;
      &lt;string&gt;stop&lt;/string&gt;
     &lt;/property&gt;
    &lt;/widget&gt;
   &lt;/widget&gt;
   &lt;resources/&gt;
   &lt;connections/&gt;
  &lt;/ui&gt;
  </code></pre>