wxPython 与 ScriptingBridge 导致退出时出现段错误

发布于 2024-12-31 21:27:34 字数 684 浏览 0 评论 0原文

这是一个非常奇怪的情况,我似乎无法弄清楚。我正在 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文