473,225 Members | 1,289 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,225 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 11396
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

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

Similar topics

10
by: hokiegal99 | last post by:
How can I make this script run w/o seeing a cmd popup window on the screen? The script works well, but each hour (when the task scheduler runs it) a brief cmd window appears and then goes away....
8
by: Gropius | last post by:
Hi i've a problem, i'd like that my application (for winxp) works in background in the taskmanager (or in the systray) instead of in a window. How can i do? Thanks!
2
by: spifster | last post by:
Hello all, I am building a collapsable tree using Javascript with DOM in IE. In order to make collapsed cells disappear I have been hiding the text. The cells collapse but still leave borders...
8
by: js | last post by:
HI guys, How do you write Perl's print a ... z, A ... Z, "\n"' in Python In Python?
12
by: adamurbas | last post by:
ya so im pretty much a newb to this whole python thing... its pretty cool but i just started today and im already having trouble. i started to use a tutorial that i found somewhere and i followed...
1
by: Steven W. Orr | last post by:
python-2.3.5 wx-2.6 I just bought the wxPython In Action book and I see that all the examples say to import wx All of our pre-existing code was horribly doing a from wxPython import * I...
5
by: mac_the_scotte | last post by:
Hi there. I downloaded python a couple of days ago from the official site and have started writing simple programs in the python gui (this being my first attempt at programming ever). The only...
3
by: Curious | last post by:
I''ve created a simple Console Application in C#.NET (.NET 2.0), and I have the following code: Console.WriteLine("Now let us begin!"); However, the string, "Now let us begin!", never shows up...
12
by: icarus | last post by:
platform: windows xp professional, python 2.5, wxpython When I double-check on my program file test.py (for simplicity I'll be using this code below), I see the window just fine. But the ms-dos...
0
by: VivesProcSPL | last post by:
Obviously, one of the original purposes of SQL is to make data query processing easy. The language uses many English-like terms and syntax in an effort to make it easy to learn, particularly for...
0
by: jianzs | last post by:
Introduction Cloud-native applications are conventionally identified as those designed and nurtured on cloud infrastructure. Such applications, rooted in cloud technologies, skillfully benefit from...
0
by: mar23 | last post by:
Here's the situation. I have a form called frmDiceInventory with subform called subfrmDice. The subform's control source is linked to a query called qryDiceInventory. I've been trying to pick up the...
0
by: abbasky | last post by:
### Vandf component communication method one: data sharing ​ Vandf components can achieve data exchange through data sharing, state sharing, events, and other methods. Vandf's data exchange method...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 7 Feb 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:30 (7.30PM). In this month's session, the creator of the excellent VBE...
0
by: fareedcanada | last post by:
Hello I am trying to split number on their count. suppose i have 121314151617 (12cnt) then number should be split like 12,13,14,15,16,17 and if 11314151617 (11cnt) then should be split like...
0
by: stefan129 | last post by:
Hey forum members, I'm exploring options for SSL certificates for multiple domains. Has anyone had experience with multi-domain SSL certificates? Any recommendations on reliable providers or specific...
1
by: davi5007 | last post by:
Hi, Basically, I am trying to automate a field named TraceabilityNo into a web page from an access form. I've got the serial held in the variable strSearchString. How can I get this into the...
0
by: MeoLessi9 | last post by:
I have VirtualBox installed on Windows 11 and now I would like to install Kali on a virtual machine. However, on the official website, I see two options: "Installer images" and "Virtual machines"....

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.