title: PyQt5 "Timers cannot be started from another thread" error when changing size of QLabel
body: <p>I am having a strange issue with PyQt5 in Python 3.5.
  I have two classes, <code>FrontEnd(QWidget)</code> and <code>TimerThread(Thread)</code>. I have a number of <code>QLabel</code>s defined in the init function of <code>FrontEnd</code>, all of which work properly.</p>
  
  <p>Shown are the relevant few functions of <code>FrontEnd</code>:</p>
  
  <pre><code>def update_ui(self):
      ret, frame = self.cam_capture.read()
  
      if self.results_pending:
          if not path.isfile('output.jpg'):
              self.results_pending = False
              with open('.out') as content_file:
                  content = content_file.readlines()[2:-2]
              system('rm .out')
              self.handle_image_classification(content)
  
      if self.take_picture:
          cv2.imwrite('output.jpg', frame)
          self.user_prompt.setText('Please wait...')
          system('./classifyimage.py --mean mean.binaryproto --nogpu --labels labels.txt model.caffemodel deploy.prototxt output.jpg &gt; .out &amp;&amp; rm output.jpg')
          self.take_picture = False
          self.results_pending = True
  
      image = QImage(frame, frame.shape[1], frame.shape[0], QImage.Format_RGB888).rgbSwapped()
      pix = QPixmap.fromImage(image)
      self.video_frame.setPixmap(pix)
  
  def update_bar_graph(self, data):
      palette = QPalette()
      palette.setColor(QPalette.Background, Qt.white)
      for i in range(0, 8):
          self.bar_graph_labels[i].setText(str(data[i]) + "%")
          height = int(data[i] * 5)
          self.bar_graph[i].setFixedSize(self.bar_width, height)
          self.bar_graph[i].move(1280 + (i * (self.bar_width + self.bar_spacing)), 640 - height)
  
  def handle_image_classification(self, raw_output):
      data = [None] * 8
      for i in range(0, len(raw_output)):
          raw_output[i] = raw_output[i].strip()
          data[int(raw_output[i][-2]) - 1] = float(raw_output[i][:-10])
      self.update_bar_graph(data)
  </code></pre>
  
  <p>And the entire TimerThread class:</p>
  
  <pre><code>class TimerThread(Thread):
      front_end = None
  
      def __init__(self, event):
          Thread.__init__(self)
          self.stopped = event
  
      def run(self):
          while not self.stopped.wait(0.02):    
              FrontEnd.update_ui(self.front_end)
  </code></pre>
  
  <p>(The <code>front_end</code> element of <code>TimerThread</code> is set on init of <code>FrontEnd</code>)</p>
  
  <p>The problem is in the <code>update_bar_graph</code> function. When the <code>setFixedSize</code> call is commented out, the program runs fine, although without properly displaying the bars of the bar graph in my application (which are <code>QLabels</code>). The <code>move</code> function seems to run properly. However, the <code>setFixedSize</code> call causes this error:</p>
  
  <pre><code>QObject::startTimer: Timers cannot be started from another thread
  QObject::startTimer: Timers cannot be started from another thread
  QObject::killTimer: Timers cannot be stopped from another thread
  QObject::startTimer: Timers cannot be started from another thread
  </code></pre>
  
  <p>I have absolutely no idea why this occurs, and why the <code>move</code> function, seemingly similar in nature, works fine. Any help would be much appreciated.
  (If I should be using a different sort of timer class or different methods for drawing large rectangles in PyQt, I am open to any such suggestions).</p>
  
  <p>EDIT:</p>
  
  <p>This is some weird stuff. I ran it twice the next day, with no changes to the code. (I think...) One time the bar graphs did not display but no errors were thrown. The other time I got this:</p>
  
  <pre><code>7fdfaf931000-7fdfaf932000 r--p 0007a000 08:07 655633                     /usr/lib/x86_64-linux-gnu/libQt5DBus.so.5.5.1
  7fdfaf932000-7fdfaf933000 rw-p 0007b000 08:07 655633                     /usr/lib/x86_64-linux-gnu/libQt5DBus.so.5.5.1
  7fdfaf933000-7fdfaf934000 rw-p 00000000 00:00 0 
  7fdfaf934000-7fdfaf971000 r-xp 00000000 08:07 667112                     /usr/lib/x86_64-linux-gnu/libxkbcommon.so.0.0.0
  7fdfaf971000-7fdfafb70000 ---p 0003d000 08:07 667112                     /usr/lib/x86_64-linux-gnu/libxkbcommon.so.0.0.0
  7fdfafb70000-7fdfafb72000 r--p 0003c000 08:07 667112                     /usr/lib/x86_64-linux-gnu/libxkbcommon.so.0.0.0
  7fdfafb72000-7fdfafb73000 rw-p 0003e000 08:07 667112                     /usr/lib/x86_64-linux-gnu/libxkbcommon.so.0.0.0
  7fdfafb73000-7fdfafb7a000 r-xp 00000000 08:07 667110                     /usr/lib/x86_64-linux-gnu/libxkbcommon-x11.so.0.0.0
  7fdfafb7a000-7fdfafd79000 ---p 00007000 08:07 667110                     /usr/lib/x86_64-linux-gnu/libxkbcommon-x11.so.0.0.0
  </code></pre>
  
  <p>I think I may have found a bug in PyQt5.</p>