4

Possible Duplicate:
How can I hide the console window in a PyQt app running on Windows?

I am programming under Python2.6 + PyQT + Eric4 environment. All the GUI and Program parts are done, but here is the problem. When I run my program, two windows pop up. One is the window (or frame) I want, the other is like a python interpretor window having a all black undergroud color. And I really don't want this to show.

What can I do to get rid of it? Please help me out of this.

Community
  • 1
  • 1
Mars_Taxi
  • 61
  • 1
  • 5

3 Answers3

5

I suppose you are using Windows, the only operating system I know to open a prompt when you double click a script. There are two solutions AFAIK: execute the file with the pythonw.exe executable, as suggested by @Adrien. If you save the file with the .pyw extension, Windows automatically uses pythonw.exe for executing the script when you double click

brandizzi
  • 26,083
  • 8
  • 103
  • 158
4

on windows, you can get rid of the console window by using pythonw.exe to run your script (instead of the standard python.exe)

(i don't know if there is a similar difference on other operating systems)

Adrien Plisson
  • 22,486
  • 6
  • 42
  • 73
3

On Windows, the program window only pops up if you save your python file with the extension .py instead of .pyw.

brandizzi
  • 26,083
  • 8
  • 103
  • 158
NotCamelCase
  • 1,073
  • 1
  • 10
  • 18
  • I'm curious to know why this might have been down-voted? – Clare Macrae Oct 09 '11 at 11:22
  • @Clare - It would have been useful for the downvoters to comment why. But it was probably because this answer got things backwards... ".py" files cause the dos window to open, and ".pyw" don't (per brandizzi's answer) – Eli Collins Oct 09 '11 at 12:23
  • @Eli ah yes, good spot - thanks for pointing out the answer is the wrong way round! – Clare Macrae Oct 09 '11 at 13:35
  • The Python black window still opens up regarding the .pyw extension of the project if it opens a web browser. How do I make the black window not opening from the beginning? – Daniel Oct 28 '20 at 21:03