title: wx python panel.Destroy() causes python 2 crash
body: <p>I've been designing a python program using wx designed to basicly copy files from one directory to another. Basically.
  The problem is, when from my main screen, you click go, the hole thing just up and crashes. WITH NO ERROR!
  I have posted code snippets below, and hopefully someone can help me with this.</p>
  
  <p>Code snippet one, this snipper shows the window being set up:</p>
  
  <pre><code>class Mywin(wx.Frame): 
   def __init__(self, parent, title): 
   global frame
    global panel
    frame=self;
    super(Mywin, self).__init__(parent, title = title,size = (350,250))
    panel = wx.Panel(self, wx.ID_ANY, style= wx.WANTS_CHARS)
    self.panel=panel
    vbox = wx.BoxSizer(wx.VERTICAL) 
    hbox1 = wx.BoxSizer(wx.HORIZONTAL) 
    l1 = wx.StaticText(panel, -1, "Backup source") 
    panel.SetBackgroundColour("black")
    hbox1.Add(l1, 1, wx.EXPAND|wx.ALIGN_LEFT|wx.ALL,5) 
    self.t1 = wx.TextCtrl(panel)
    hbox1.Add(self.t1,1,wx.EXPAND|wx.ALIGN_LEFT|wx.ALL,5) 
    vbox.Add(hbox1) 
    browse1 = wx.Button(panel, -1, "Browse")
    browse1.Bind(wx.EVT_BUTTON, self.browsebutton1)
    hbox1.Add(browse1,1,wx.EXPAND|wx.ALIGN_LEFT|wx.ALL,5) 
    vbox.Add(hbox1)
    hbox2 = wx.BoxSizer(wx.HORIZONTAL) 
    l2 = wx.StaticText(panel, -1, "Backup destination") 
    hbox2.Add(l2, 1, wx.EXPAND|wx.ALIGN_LEFT|wx.ALL,5) 
    self.t2 = wx.TextCtrl(panel)
    hbox2.Add(self.t2,1,wx.EXPAND|wx.ALIGN_LEFT|wx.ALL,5) 
    browse2 = wx.Button(panel, -1, "Browse")
    browse2.Bind(wx.EVT_BUTTON, self.browsebutton2)
    hbox2.Add(browse2,1,wx.EXPAND|wx.ALIGN_LEFT|wx.ALL,5) 
    vbox.Add(hbox2)
    hbox3 = wx.BoxSizer(wx.HORIZONTAL) 
    sel=wx.CheckBox(panel, label = 'write to log file')
    self.cb1 = sel
    sel2=wx.CheckBox(panel, label = 'delete files found in destination that are not found in source?')
    self.cb2 = sel2
    hbox3.Add(sel,1,wx.EXPAND|wx.ALIGN_LEFT|wx.ALL,5) 
    hbox3.Add(sel2,1,wx.EXPAND|wx.ALIGN_LEFT|wx.ALL,5) 
    vbox.Add(hbox3)
    gobutton = wx.Button(panel, -1, "go!")
    gobutton.Bind(wx.EVT_BUTTON, self.go)
    vbox.Add(gobutton)
    panel.SetSizer(vbox)
    Publisher.subscribe(self.updatestuff, "update")
    self.Center()
    self.Show();
    self.Fit()
  </code></pre>
  
  <p>Code snippet two, from the go button:</p>
  
  <pre><code> def go(self, again):
    sourcepath=os.path.realpath(self.t1.GetValue())
    print 'got source'
    destpath=os.path.realpath(self.t2.GetValue())
    print 'got source'
    if(os.path.exists(sourcepath)==False):
     wx.MessageBox("Source path not valid", 'error!', wx.OK | wx.ICON_INFORMATION)
     return;
    if(os.path.exists(destpath)==False):
     wx.MessageBox("Destination path not valid", 'error!', wx.OK | wx.ICON_INFORMATION)
     return;
    if(sourcepath==destpath):
     wx.MessageBox("The source and destination path may not be the same.", 'error!', wx.OK | wx.ICON_INFORMATION)
     return;
    print 'checked source and dest valid'
    self.backup(sourcepath, destpath, self.cb1.GetValue(), self.cb2.GetValue())
  </code></pre>
  
  <p>code snippet 3, where it crashes:</p>
  
  <pre><code> def backup(self, source, dest, log, deletee):
    print 'readying screen'
    global frame
    self=frame
    global panel
   global dolog
    global dodel
    global starttime
    starttime=time.time()
    print 'got time set crrectly'
    dolog=log
    print 'set logging';
    self.panel.Destroy();
  </code></pre>
  
  <p>It gets as far as setting up log, before the wx window freezes[not responding], and then python2.exe comes as stopped working, and windows will search for a solution.
  I've tried reinstalling wx python, and that did not fix it.
  I also tried using panel as a global variable, but that produced the same error.
  Any help on this matter would be appreciated, and if anyone has any glew to stick my hair back on that is also helpful, because I've pulled it all out! :)
  Thanks</p>