Win XP: How to hide command window for sub processes?

2009-10-29 Thread klausfpga
Hi,

I have a Python script which wants to start a subprocess and wait for
it to finish.

However I would like to have NO command window popping up during
execution.

My main Python script is started with the .pyw suffix, thus I got rid
of the main console and I just see my GUI.

So far I tried
os.system()

and subprocess.call()

with os.system() the command window pops up and I see my commands
output.

with the subprocess.call() and stdin ./ stdout / stderr redirection I
manage  to get rid of stdout/stderr
( redirecting to the file 'NUL:' )

but the window stays.

the subprocess is a call to a .exe file with multiple parameters.

I would appreciate any hints


bye


Klaus
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Win XP: How to hide command window for sub processes?

2009-10-29 Thread klausfpga
On Oct 29, 11:25 am, Rüdiger Ranft <_r...@web.de> wrote:
> klausfpga schrieb:
>
> > Hi,
>
> > I have a Python script which wants to start a subprocess and wait for
> > it to finish.
>
> > However I would like to have NO command window popping up during
> > execution.
>
> You need to specify the hide parameter for windows.
>
> import subprocess
> kwargs = {}
> if subprocess.mswindows:
>     su = subprocess.STARTUPINFO()
>     su.dwFlags |= subprocess.STARTF_USESHOWWINDOW
>     su.wShowWindow = subprocess.SW_HIDE
>     kwargs['startupinfo'] = su
> process = subprocess.Popen( (r'c:\python25\python.exe',
>     r'd:\projekte\bar.py'), **kwargs )

Thanks Ruediger,

I'll try that immediately tomorrow, when working again on a windows
host.

Good to know, that the Python API supports this.
though this feature was not that easy to be found in the doc.

This will make my application much nicer.
-- 
http://mail.python.org/mailman/listinfo/python-list


How to start a windows application minimized (or hidden)

2010-11-29 Thread klausfpga
Hi,

I'd like to start a windows application minimized


As an example I used
calc.exe

what I tried was using the startupinfo field of subprocess.Popen
though I'm not sure, that 'hidden' is really the same as minimized.

st_info = subprocess.STARTUPINFO()
st_info.dwFlags |= subprocess.STARTF_USESHOWWINDOW
st_info.wShowWindow = subprocess.SW_HIDE
proc = Popen( [ "cmd.exe" ], startupinfo = st_info)





I also tried creating a shortut of calc on my desktop and setting it
to
'start minimized'

if I click on the shortcut, then calc.exe shows up as a visible window

What am I doing wrong/

Thanks in advance for any ideas


somehow I do not see, that
-- 
http://mail.python.org/mailman/listinfo/python-list