我在我的python函数中遇到了麻烦,我在exe程序中调用了返回结果,用于在python代码中执行以检测屏幕中的系统鼠标形状。 exe函数将返回每个鼠标形状状态(箭头,手)的不同结果。 问题是当python函数调用exe时,出现Windows shell包含我想要的结果,我通过以下方式阅读:
def check():
program = r'D:\vs project\aaaaaa\Debug\mousedetect.exe'
with subprocess.Popen([program], stdout=subprocess.PIPE, universal_newlines=True,shell=False) as p:
for line in p.stdout:
print(line)
在Windows shell出现的位置,它覆盖屏幕,因此屏幕返回时鼠标状态的值是错误的。那么,无论如何都要运行exe来获取Window shell,并在后台运行Windows shell?