wx.App console window [Windows]

S

siwiak

Hi All,

I'm looking for a way to hide console window created by wx.App class.

examplary code below:

import wx

class Gui(wx.App):
def __init__(self, *pargs, **kwargs):
wx.App.__init__(self, *pargs, **kwargs)


if __name__ == "__main__":
app = Gui()
app.MainLoop()

produces a blank console window (than dies).

What shall I do to make wx.App run without raising console window?

thanks in advance
 
K

kyosohma

Hi All,

I'm looking for a way to hide console window created by wx.App class.

examplary code below:

import wx

class Gui(wx.App):
def __init__(self, *pargs, **kwargs):
wx.App.__init__(self, *pargs, **kwargs)

if __name__ == "__main__":
app = Gui()
app.MainLoop()

produces a blank console window (than dies).

What shall I do to make wx.App run without raising console window?

thanks in advance

Save the file as a *.pyw. And I would recommend adding the following 2
lines to your __init__ :

<code>

frame = wx.Frame(None, wx.ID_ANY, title='My Title')
frame.Show()

</code>

Maybe even stick in a panel object for that matter.

Mike
 
S

siwiak

Save the file as a *.pyw. And I would recommend adding the following 2
lines to your __init__ :

<code>

frame = wx.Frame(None, wx.ID_ANY, title='My Title')
frame.Show()

</code>

Maybe even stick in a panel object for that matter.

Mike

Thank you Mike, *.pyw made the first part of the trick just perfectly.
Thanks to your answer I was able to ask google proper question
concerning second part. Below (for possible future readers) I attach
solution I found:

People looking for possibility of running wx.App no console version
after py2exe compilation:
in setup script change 'console = ['foo.py']' for 'windows = ['foo.py']
 
K

kyosohma

On Jul 12, 3:44 pm, (e-mail address removed) wrote:
Save the file as a *.pyw. And I would recommend adding the following 2
lines to your __init__ :

frame = wx.Frame(None, wx.ID_ANY, title='My Title')
frame.Show()

Maybe even stick in a panel object for that matter.

Thank you Mike, *.pyw made the first part of the trick just perfectly.
Thanks to your answer I was able to ask google proper question
concerning second part. Below (for possible future readers) I attach
solution I found:

People looking for possibility of running wx.App no console version
after py2exe compilation:
in setup script change 'console = ['foo.py']' for 'windows = ['foo.py']

I like the GUI interface to py2exe that I found here:
http://xoomer.alice.it/infinity77/eng/GUI2Exe.html

Quite handy.

Mike
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top