On Aug 28, 4:08 am, geoffbache <[EMAIL PROTECTED]> wrote: > On Aug 27, 11:28 pm, [EMAIL PROTECTED] wrote: > > > > > On Aug 27, 3:21 pm, geoffbache <[EMAIL PROTECTED]> wrote: > > > > Hi, > > > > As part of my efforts to write a test tool that copes with GUIs > > > nicely, I'm trying to establish how I can start a GUI process on > > > Windows that will not bring up the window. So I try to hide the window > > > as follows: > > > > info = subprocess.STARTUPINFO() > > > info.dwFlags |= subprocess.STARTF_USESHOWWINDOW > > > info.wShowWindow = subprocess.SW_HIDE > > > > proc = subprocess.Popen(..., startupinfo=info) > > > > This works, in a way, but doesn't work recursively. I.e. if the > > > started process itself starts a window, that second window will not be > > > hidden. This even applies to dialog boxes within the application. So > > > instead of a lot of windows popping up I now get a lot of disembodied > > > dialogs appearing, which is a slight improvement but not much. > > > > Also, certain processes (e.g. tkdiff) seem to ignore the directive to > > > be hidden altogether. > > > > This is dead easy on UNIX with virtual displays like Xvfb. Can someone > > > shed any light if it's possible on Windows from python? > > > > Regards, > > > Geoff Bache > > > I'm confused. Why would you create a GUI if you're not going to > > actually display it? Isn't that the point of a GUI? Or are you talking > > about the command window popping up? > > > Mike > > Only in the context of testing it. If I run lots of GUI tests on my > computer I want > the tested GUIs to remain hidden so I can still use my computer in the > meantime... > > Though if you can tell me how to stop the command window popping up on > Windows > I'll be grateful for that too (though it wasn't the original > question). > > Geoff
Which GUI toolkit are you using? Tkinter, wxPython, pyQt? As for losing the command window on Windows, the best way that I know of is to just change the extension of the python file itself from *.py to *.pyw . I'm pretty sure you can suppress command windows if you're calling them from the command line using a flag, but I can't recall the flag off the top of my head. One way to test while still being able to use your computer is to install a virtual machine with VMWare or some similar product. I use VMWare's free software for testing some of my scripts, but I've heard that Microsoft's got a free virtual product that isn't half bad. Mike -- http://mail.python.org/mailman/listinfo/python-list