wxPython 与 ScriptingBridge 导致退出时出现段错误
这是一个非常奇怪的情况,我似乎无法弄清楚。我正在 OSX Lion(wxpython 版本 2,9,3,1)上使用 wxPython 编写一个应用程序。
每当我从 ScriptingBridge 导入并执行一些简单的操作(例如创建一个框架然后关闭它)时,它不会完全关闭,并且在关闭时出现段错误。尝试一下这段代码:
from ScriptingBridge import *
import wx
class Test(wx.Frame):
def __init__(self, parent, title):
super(Test, self).__init__(parent, title=title, size=(300, 200))
self.Show()
app = wx.App()
Test(None, 'Hello')
app.MainLoop()
运行这段代码后,只需将其关闭即可。它应该分段错误。现在,只需注释掉 ScriptingBridge 导入并再次运行它并关闭它即可。无段故障。
更奇怪的是,如果您只是创建一个导入 ScriptingBridge 的脚本,但不导入 wxPython,一旦脚本退出,它将不会 seg 错误...看起来它是二。
有没有人看到过这个并且他们找到了解决方法吗?如果可能的话,我希望我的应用程序能够干净地退出。
This is a very odd situation that I can not seem to figure out. I'm writing an application with wxPython on OSX Lion (wxpython version 2,9,3,1).
Whenever I import from ScriptingBridge and do something as simple as create a frame and then close it, it does not close cleanly and seg faults upon closing. Give this code a try:
from ScriptingBridge import *
import wx
class Test(wx.Frame):
def __init__(self, parent, title):
super(Test, self).__init__(parent, title=title, size=(300, 200))
self.Show()
app = wx.App()
Test(None, 'Hello')
app.MainLoop()
After running this code, just simply close it. It should seg fault. Now, simply comment out the ScriptingBridge import and run it again and close it. No Seg Fault.
What makes this even stranger is that if you just create a script that imports ScriptingBridge and yet does not import wxPython, once the script exits, it will not seg fault... It appears it's a combination between the two.
Has anyone seen this and have they found a work around for it? I'd like my app to exit cleanly if possible.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论