471,330 Members | 1,048 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,330 software developers and data experts.

How to hide python cmd "black" window (wxpython)

luke14free
Hello guys,
I've been searching for a method to hide the console (as c/c++ user would say) under windows, but i found nothing really helpful.
What I found is:
1) I need to rename file as pyw. But when I do so, code just doesn't give any output or open windows, it just close itself...
2) I need to create a "python" service...But how?
Is there another simpler method to tell python that my main window is the frame and not the console? I'm working with boa, and my app code is that:
Expand|Select|Wrap|Line Numbers
  1. import wx
  2.  
  3. import fatturefr1
  4.  
  5. modules ={'fatturefr1': [1, 'Main frame of Application', 'fatturefr1.py']}
  6.  
  7. class BoaApp(wx.App):
  8.     def OnInit(self):
  9.         self.main = fatturefr1.create(None)
  10.         self.main.Show()
  11.         self.SetTopWindow(self.main)
  12.         return True
  13.  
  14. def main():
  15.     application = BoaApp(0)
  16.     application.MainLoop()
  17.  
  18. if __name__ == '__main__':
  19.     main()
  20.  
Thanks and greetings,
Luke
Oct 25 '07 #1
2 11114
The only way that I've been able to hide the console window was to use PyInstaller to convert my python script into an executable. It has an option to keep the console from opening when you run the program (and many other options, like packing everything into a single file). This is probably not the kind of solution you are looking for, but maybe you can use it as a last resort if it's necessary that there's no console window.
Oct 25 '07 #2
bartonc
6,596 Expert 4TB
Hello guys,
I've been searching for a method to hide the console (as c/c++ user would say) under windows, but i found nothing really helpful.
What I found is:
1) I need to rename file as pyw. But when I do so, code just doesn't give any output or open windows, it just close itself...
2) I need to create a "python" service...But how?
Is there another simpler method to tell python that my main window is the frame and not the console? I'm working with boa, and my app code is that:
Expand|Select|Wrap|Line Numbers
  1. import wx
  2.  
  3. import fatturefr1
  4.  
  5. modules ={'fatturefr1': [1, 'Main frame of Application', 'fatturefr1.py']}
  6.  
  7. class BoaApp(wx.App):
  8.     def OnInit(self):
  9.         self.main = fatturefr1.create(None)
  10.         self.main.Show()
  11.         self.SetTopWindow(self.main)
  12.         return True
  13.  
  14. def main():
  15.     application = BoaApp(0)
  16.     application.MainLoop()
  17.  
  18. if __name__ == '__main__':
  19.     main()
  20.  
Thanks and greetings,
Luke
  1. I use the .pyw (python - no console window) trick all the time.
  2. I don't know where you get that "create a python process" from.
  3. Boa Constructor will consume the output intended for the output. Make sure that you have split the editor window to show (Traceback) (Output), etc. tabs.
  4. Play with
    Expand|Select|Wrap|Line Numbers
    1. application = BoaApp(redirect=False) # True
    while using .pyw. Due to #3, do this from the command-line.
??? This is windows, right ???
Oct 25 '07 #3

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

10 posts views Thread by hokiegal99 | last post: by
8 posts views Thread by Gropius | last post: by
2 posts views Thread by spifster | last post: by
8 posts views Thread by js | last post: by
12 posts views Thread by adamurbas | last post: by
1 post views Thread by Steven W. Orr | last post: by
5 posts views Thread by mac_the_scotte | last post: by
reply views Thread by rosydwin | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.