[英]python open folder on top of other windows
I have build in flask app, that recive a path and then open a folder.我已经构建了 flask 应用程序,它接收路径然后打开一个文件夹。 my issue is that the folder is opened minimized and i would like to open it on top of all windows.我的问题是该文件夹已最小化打开,我想在所有 windows 之上打开它。 how can I achieve it?我怎样才能实现它? I'm entering the URL http://localhost:9999/number from other web and it does open the folder just minimize:(我正在输入 URL http://localhost:9999/number 来自其他 web 并打开文件夹只是最小化:(
CLOSE_TAB = "<script>window.onload = window.close();</script>"
@app.route('/<number>')
def open_folder(number):
try:
home = str(Path.home())
full_path = home + '/' + number
folder_path = os.path.realpath(full_path)
if os.path.exists(folder_path):
#Open my folder by number
os.startfile(folder_path)
return CLOSE_TAB
else:
return FOLDER_NOT_FOUND
except Exception as error:
print(error)
return "{}".format(str(error))
if __name__ == '__main__':
app.run(host="localhost", port=9999)
Since Python 3.10 the function os.startfile
has parameter show_cmd
which takes one of the int values documented for Win32's function ShowWindow
for parameter nCmdShow
.自 Python 3.10 起,function os.startfile
具有参数show_cmd
,该参数采用 Win32 的ShowWindow
参数nCmdShow
记录的 int 值之一
Among others there is其中有
It is up to the started application if the argument is respected.如果参数得到尊重,则取决于启动的应用程序。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.