在官方文档中有这样一段描述
Note that calling Close does not guarantee that the window will be destroyed; but it provides a way to simulate a manual close of a window, which may or may not be implemented by destroying the window.
意思是Close()不保证窗口被关闭,但是它提供了一种模拟用户手动关闭窗口的方式
Close()调用的是wx.CloseEvent,关于wx.CloseEvent的描述中有这样一段
You should check whether the application is forcing the deletion of the window using wx.CloseEvent.CanVeto . If this is False, you must destroy the window using wx.Window.Destroy .
因此,为了关闭窗口保险起见应该使用Destory()。
我猜想,如果OnClose()函数定义的有问题,Close()这种模仿用户关闭窗口的方式就会失效。