我正在使用close\u fds=True子流程.Popen但还是要打开文件两次。我找了很多,但找不到解决办法。你知道吗
我想打开一个文件并截图。你知道吗
import os
import pyscreenshot as ImageGrab
import subprocess as sp
import time
def imagegrabber(x=0):
if(x==1 and __name__ == '__main__'):
# part of the screen
im=ImageGrab.grab(bbox=(50,70,500,500))
im.show()
# to file
ImageGrab.grab_to_file('im.png')
return;
def Dashboard(x=0):
if(x==1):
mcr = "D:/MCR/test.pbix"
path = r'C:\Program Files\Microsoft Power BI Desktop\bin\PBIDesktop.exe'
sp.Popen([path,mcr],close_fds=True)
time.sleep(10)
imagegrabber(1)
return;
Dashboard(1)
我只需要在Dashboard函数中添加if(name='main'),而不是在imagegrabber函数中。休息,一切都好。你知道吗
相关问题 更多 >
编程相关推荐