I'm making my own chess GUI and am using python chess and stockfish for it. After freezing it into an executable, every time I call chess.engine.SimpleEngine.popen_uci('location\\of\\stockfish')
, it opens the shell for stockfish and if I close the shell, stockfish stops working. What do I do so that the shell is only running in the background and is not visible to the user?
This is a platform-specific question and I am guessing from 'location\\of\\stockfish'
that Windows is the platform you are interested in.
popen_uci
accepts a ** (extra keywords) parameter and you can use that to pass parameters through to subprocess.Popen()
. Use the passthrough parameter startupinfo
to provide an instance of subprocess.STARTUPINFO
. That in turn can set the win32 flag wShowWindow
to do what you want.