Python应用程序无法打开(使用py2app构建)

时间:2015-03-10 01:00:30

标签: python macos user-interface wxpython py2app

使用wxPython并使用py2app构建它,我尝试构建一个准系统基本gui应用程序。然而,当我打开它时,停靠站只是口吃,好像要打开一些东西,然后它就没有了。知道为什么吗?

我正在运行OS X 10.10.2和python 2.7.9以及wxPython 3.0.2.0 osx-cocoa(经典)

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'],
 )

0 个答案:

没有答案