开发者

how to hide black file background about wxpython

please see the image first http://libertygroupllc.com/twowindow.jpg

hi, look at this image, if i click the py.exe file which was setted up by py2exe, there are two windows to be showed.... apparently, i don't want the black background (that is python.exe)... so how to hide it so that when i click the py.exe, and only one window will be showed....

thank you ~


to Mark:

hi, i try that, but it is NOT working... let me explain more...

i have one test.py file like below:

import wx
class gideon(wx.Frame):
    def __init__(self,parent,id):
    wx.Frame.__init__(self,parent,id,'This is a new window',size=(500,400))
    panel = wx.Panel(self)

    button = wx.Button(panel,label='Exit',pos=(130,10),size=(60,60))
    self.Bind(wx.EVT_BUTTON,self.closebutton,button)
    self.Bind(wx.EVT_CLOSE,self.closewindow)

    status = self.CreateStatusBar()
    menubar = wx.MenuBar()
    first = wx.Menu()
    second = wx.Menu()
    first.Append(wx.NewId(),'New Window','This is a new window')
    first.Append(wx.NewId(),'Open...','This will open a new window')
    menubar.Append(first,'File')
    menubar.Append(second,'Edit')
    self.SetMenuBar(menubar)

def closebutton(self,event):
    self.Close(True)

def closewindow(self,event):
    self.Destroy()

if __name__ == '__main__':
app = wx.PySimpleApp()
frame = gideon(paren开发者_运维技巧t=None,id=-1)
frame.Show()
app.MainLoop()

and setup.py

from distutils.core import setup
import py2exe
setup(
console=["test.pyw"],
options = { "py2exe": { "dll_excludes": ["MSVCP90.dll"] } }
)

i put this two files on the desktop, and cmd => cd desktop => setup.py py2exe

i can do Unsuccessfully according to your meaning neither test.py nor test.pyw...


Rename your python file to be a .pyw file. Doing so will prevent the first command prompt window from displaying.

EDIT: After your clarification, the problem is in your setup.py file. You should use 'windows=' instead of 'console='. You can find a more complete list of options that you can use in your setup.py file here.

By using:

windows=[ 'test.py' ]

you are telling py2exe to build a GUI executable, which should then prevent the command prompt from showing.

Also, you can use 'test.py' as your input as opposed to 'test.pyw'.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜