首页 > 解决方案 > Python Chess:如何阻止 chess.engine.SimpleEngine.popen_uci() 打开 shell

问题描述

我正在制作自己的国际象棋 GUI,并为此使用 python 国际象棋和鱼。将其冻结为可执行文件后,每次调用时chess.engine.SimpleEngine.popen_uci('location\\of\\stockfish'),它都会为 stockfish 打开 shell,如果我关闭 shell,stockfish 将停止工作。我该怎么做才能使外壳仅在后台运行并且对用户不可见?

标签: pythonchesspython-chess

解决方案


扩展@BoarGules 答案:

engine = chess.engine.SimpleEngine.popen_uci(sf,startupinfo = subprocess.STARTUPINFO(dwFlags=subprocess.STARTF_USESHOWWINDOW))

推荐阅读