from PyQt5.QtCore import QUrl
from PyQt5.QtGui import QDesktopServices
def button_show_dir(self):
default_dir = "./report_pdf"
show_dirPath = 0
if self.dir_choose == 0:
show_dirPath = default_dir
else:
show_dirPath = self.dir_choose
url = QUrl.fromLocalFile(show_dirPath)
if url:
print("选择的文件夹路径:", show_dirPath)
else:
print("未选择文件夹")
QDesktopServices.openUrl(url)
PyQt 打开文件夹路径
最新推荐文章于 2024-09-14 08:25:16 发布