code: def update_result_ctrl(self, event):
          
  
          # Check to see if macro window still exists
          if not self:
              return
  
          printLen = 0
          self.result_ctrl.SetValue('')
          if hasattr(event, 'msg'):
              # Output of script (from print statements, for example)
              self.result_ctrl.AppendText(event.msg)
              printLen = len(event.msg)
          if hasattr(event, 'err'):
              # Error messages
              errLen = len(event.err)
              errStyle = wx.TextAttr(wx.RED)
              self.result_ctrl.AppendText(event.err)
              self.result_ctrl.SetStyle(printLen, printLen+errLen, errStyle)
  
          if not hasattr(event, 'err') or event.err == '':
              # No error passed.  Close dialog if user requested it.
              if self._ok_pressed:
                  self.Destroy()
          self._ok_pressed = False
docs: Update event result following execution by main window