Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > wx.App console window [Windows]

Reply
Thread Tools

wx.App console window [Windows]

 
 
siwiak@gmail.com
Guest
Posts: n/a
 
      07-12-2007
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

 
Reply With Quote
 
 
 
 
kyosohma@gmail.com
Guest
Posts: n/a
 
      07-12-2007
On Jul 12, 3:44 pm, (E-Mail Removed) wrote:
> 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

 
Reply With Quote
 
 
 
 
siwiak@gmail.com
Guest
Posts: n/a
 
      07-12-2007
On 13 Lip, 00:28, (E-Mail Removed) wrote:
> On Jul 12, 3:44 pm, (E-Mail Removed) wrote:
>
>
>
> > 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


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

 
Reply With Quote
 
kyosohma@gmail.com
Guest
Posts: n/a
 
      07-13-2007
On Jul 12, 5:55 pm, (E-Mail Removed) wrote:
> On 13 Lip, 00:28, (E-Mail Removed) wrote:
>
>
>
> > On Jul 12, 3:44 pm, (E-Mail Removed) wrote:

>
> > > 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

>
> 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

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Reading console output and writing to console jan.rebada@gmail.com C++ 5 03-04-2008 09:00 AM
Preventing the console window from closing when writing a console program in C++ Miktor C++ 7 08-09-2005 09:22 PM
Re: console mp3->wav decoder for $indows or GUI one which supports console Serge Terekhoff Python 0 06-30-2003 12:36 PM
Re: console mp3->wav decoder for $indows or GUI one which supports console Egor Bolonev Python 0 06-30-2003 10:43 AM
Re: console mp3->wav decoder for $indows or GUI one which supports console Ben Finney Python 2 06-30-2003 05:43 AM



Advertisments