Disable cmd opening from GUI (PyQt)

424 Views Asked by At

I have a GUI (created with PyQt5 and py2exe). This GUI takes input data (shp, images..) and uses them as parameters in softwares (ie FME). Whenever I launch a task on a software through the GUi, a cmd opens.

To launch the softwares, I use subprocess.Popen in my script with a shell=False parameter. Can that be the reason why the cmd opens ? Should I use os.system or something else to avoid having a cmd/DOS poping every time ?

Or is this not related to the way I launch anything ?

1

There are 1 best solutions below

2
On BEST ANSWER

This appears to have been solved in the questions that I linked. For reference, the solution appears to be as follows:

startupinfo = subprocess.STARTUPINFO()
startupinfo.dwFlags |= subprocess.STARTF_USESHOWWINDOW
return subprocess.Popen([command] + args, startupinfo=startupinfo).wait()