473,398 Members | 2,335 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,398 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 11425
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: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.