title: How to refresh wx.StaticText that is out of class in wxPython?
body: <p>I am having trouble in trying to get static text to refresh when the user clicks 'ok' on a different window.  I need the main window to refresh when the user adds something from a different window. Code:</p>
  
  <pre><code>import wx
  import random
  class oranges(wx.Frame):
  
      def __init__(self,parent,id):
          wx.Frame.__init__(self,parent,id,'Testing Sample',size=(1024,768))
          self.frame=wx.Panel(self)
          self.static_text=wx.StaticText(self.frame,-1,str(random.randint(1,100)),pos=(500,500))
          re_button=wx.Button(self.frame,label='Refresh',pos=(200,200),size=(50,50))
          self.Bind(wx.EVT_BUTTON,self.refresh,re_button)
          re_buttoned=wx.Button(self.frame,label='ok',pos=(100,100),size=(50,50))
          self.Bind(wx.EVT_BUTTON,self.another_thing,re_buttoned)
      def refresh(self,event):
          self.static_text.Destroy()
          ra_again=random.randint(1,100)
          self.static_text=wx.StaticText(self.frame,-1,str(ra_again),pos=(500,500))
      def another_thing(self,event):
          class apples(wx.Frame):
              def __init__(self,parent,id):
                  wx.Frame.__init__(self,parent,id,'Testing Different sample',size=(1024,768))
                  self.frames=wx.Panel(self)
                  self.static_text.Destroy()
                  ra_again=random.randint(1,100)
                  self.static_text=wx.StaticText(self.frame,-1,str(ra_again),pos=(500,500))
          if __name__ =='__main__':
              apps = wx.PySimpleApp()
              windows = apples(parent=None,id=-1)
              windows.Show()
              apps.MainLoop()
  if __name__ =='__main__':
      app = wx.PySimpleApp()
      window = oranges(parent=None,id=-1)
      window.Show()
      app.MainLoop()
  </code></pre>
  
  <p>I get this error when I press the button: AttributeError: <code>'apples' object has no attribute 'static_text'</code>.  Sorry for the messy code as this is just to show what the problem is. Thanks a bunch in advance! Looking forward to the answers!</p>