title: Good approach for updating the GUI continuously in wxPython using threads?
body: <p>I am working on a GUI app using python v2.7 and wxPython v3.0 on windows 7 OS.
  I have to update my GUI continuously which contains lots of panels. Each panels contains a <code>wx.StaticText</code>. I have to update these <code>wx.StaticTexts</code> continuously. I thought of using <code>threads</code>. Also I am using <code>pubsub</code> module for communicating with the GUI to update these <code>wx.StaticTexts</code>. Every thing works as intended.
  I have created a short demo below of my real problem.</p>
  
  <p><strong>Problem</strong>: In my code below, two threads are created. Both the threads are able to update the GUI using <code>wx.CallAfter()</code>. What if I have 100 panels to update? Do I need to create 100 classes for each of the thread which updates a particular panel? I want the threads to work independently of the other threads.
  What will possibly be the better approach than this one?</p>
  
  <p><strong>Code</strong>: Please find the sample code below to play around:</p>
  
  <pre><code>import wx
  from wx.lib.pubsub import setupkwargs
  from wx.lib.pubsub import pub
  import time
  from threading import Thread
  import threading
  
  class GUI(wx.Frame):
      def __init__(self, parent, id, title):
          screenWidth = 500
          screenHeight = 400
          screenSize = (screenWidth,screenHeight)
          wx.Frame.__init__(self, None, id, title, size=screenSize)
          self.locationFont = locationFont = wx.Font(12, wx.MODERN, wx.NORMAL, wx.BOLD)
          mainSizer = wx.BoxSizer(wx.VERTICAL)
          myPanelA = wx.Panel(self, style=wx.SIMPLE_BORDER)
          myPanelA.SetBackgroundColour('#C0FAE0')
          self.myTextA = wx.StaticText(myPanelA, -1, "I have a problem :( ")
          myPanelB = wx.Panel(self, style=wx.SIMPLE_BORDER)
          myPanelB.SetBackgroundColour('#C0FAFF')
          self.myTextB = wx.StaticText(myPanelB, -1, "Me too :( ")
          mainSizer.Add(myPanelA, 1, wx.EXPAND, 5)
          mainSizer.Add(myPanelB, 1, wx.EXPAND, 5)
          self.SetSizer(mainSizer)
          pub.subscribe(self.updatePanelA, 'Update-panelA')
          pub.subscribe(self.updatePanelB, 'Update-panelB')
  
      def updatePanelA(self, message):
          self.myTextA.SetLabel(message)
  
      def updatePanelB(self, message):
          self.myTextB.SetLabel(message)
  
  class threadA(Thread):
      def __init__(self):
          Thread.__init__(self)
          self.start()
      def run(self):
          ObjA = updateGUI()
          ObjA.methodA()
  
  class threadB(Thread):
      def __init__(self):
          Thread.__init__(self)
          self.start()
      def run(self):
          ObjB = updateGUI()
          ObjB.methodB()
  
  class updateGUI():
      def methodA(self):
          while True:
              time.sleep(3)
              wx.CallAfter(pub.sendMessage, 'Update-panelA', message='Problem solved')
      def methodB(self):
          while True:
              time.sleep(5)
              wx.CallAfter(pub.sendMessage, 'Update-panelB', message='Mine too')
  
  if __name__=='__main__':
      app = wx.App()
      frame = GUI(parent=None, id=-1, title="Problem Demo")
      frame.Show()
      threadA()
      threadB()
      app.MainLoop()
  </code></pre>
  
  <p>Thank you for your time!</p>