473,289 Members | 1,829 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,289 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 11407
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...
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: 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"....
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
by: marcoviolo | last post by:
Dear all, I would like to implement on my worksheet an vlookup dynamic , that consider a change of pivot excel via win32com, from an external excel (without open it) and save the new file into a...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...

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.