【发布时间】:2021-09-11 19:19:08
【问题描述】:
我正在尝试使用 zipfile 模块的 zip 文件提取功能的 GUI。这是我第一次使用Gooey,我遵循文档并实现了我想要的,GUI 似乎很好,但是提取功能不起作用。我不知道我错过了什么。任何帮助,将不胜感激!这是正在处理的代码。
from zipfile import ZipFile
from gooey import Gooey, GooeyParser
def extract_all_files(files, path_to_extract_to):
with ZipFile(files, 'r') as file:
file.extractall(path_to_extract_to)
@Gooey(program_name="Archive Manager", program_description="Extract files")
def parse_args():
parser = GooeyParser()
subparsers = parser.add_subparsers(required=True)
extractor = subparsers.add_parser("Extract", help="Extract zip files")
extractor.add_argument('input_file', widget="FileChooser", help="File to extract")
extractor.add_argument('output_file', widget="DirChooser", help="Extracted file location")
return parser.parse_args()
@Gooey
def main():
args = parse_args()
files = args.input_file
path = args.output_file
extract_all_files(files, path)
if __name__ == "__main__":
main()
【问题讨论】:
-
抱歉,“停止工作”不是有效的、可行的问题陈述。
-
@JonathonReinhart 我的意思是,该功能本身就可以工作,但是当我将它与粘糊糊的东西集成时,它就不行了;t。因为我是新手,所以我希望你们中的一个人能对它有所了解。