Python应用程序无法打开(使用py2app构建)
使用wxPython并使用py2app构建它,我尝试构建一个基本的gui应用程序。然而,当我打开它的时候,码头只是口吃,好像它要打开什么东西,然后它就没有了。知道为什么吗 我正在运行OSX10.10.2、Python2.7.9和Wxpython3.0.2.0OSXCocoaClassicPython应用程序无法打开(使用py2app构建),python,macos,user-interface,wxpython,py2app,Python,Macos,User Interface,Wxpython,Py2app,使用wxPython并使用py2app构建它,我尝试构建一个基本的gui应用程序。然而,当我打开它的时候,码头只是口吃,好像它要打开什么东西,然后它就没有了。知道为什么吗 我正在运行OSX10.10.2、Python2.7.9和Wxpython3.0.2.0OSXCocoaClassic import wx class MainFrame(wx.Frame): def __init__(self, parent, title): wx.Frame.__init__(se
import wx
class MainFrame(wx.Frame):
def __init__(self, parent, title):
wx.Frame.__init__(self, parent, title=title, size=(400,200))
#Creating the menu
filemenu = wx.Menu()
filemenu.Append(wx.ID_ABOUT, "&About", " This is the about panel.")
filemenu.AppendSeparator()
filemenu.Append(wx.ID_EXIT, "E&xit", " Terminate the program")
#Adding the menu bar
menuBar = wx.MenuBar()
menuBar.Append(filemenu, "&File")
self.SetMenuBar(menuBar)
self.Show(True)
app = wx.App(False)
frame = MainFrame(None, "Hello World")
app.MainLoop()
setup.py文件如下所示
from setuptools import setup
APP = ['sample.py'] #main file of your app
DATA_FILES = []
OPTIONS = {'argv_emulation': True,
'site_packages': True,
'arch': 'i386',
'plist': {
'CFBundleName': 'GUI Sample App',
'CFBundleShortVersionString':'1.0.0',
'CFBundleVersion': '1.0.0',
'CFBundleIdentifier':'com.cclloyd.guisample',
'NSHumanReadableCopyright': '@ cclloyd 2015',
'CFBundleDevelopmentRegion': 'English',
},
}
setup(
app=APP,
data_files=DATA_FILES,
options={'py2app': OPTIONS},
setup_requires=['py2app'],
)
你的样品似乎对我很有用。检查py2app及其依赖项是否是最新的。您可能还希望尝试从命令行运行YourApp.app/Contents/MacOS/YourApp,以查看引导或启动代码中是否出现异常,例如某些内容未绑定。