I was trying to a GUI for a zip file extracted function I did use the
zipfile module. It’s my first time using
Gooey, I followed the docs and implemented what I wanted, the GUI seems to be fine, but the extracting functionality doesn’t work. I don’t know what I missed. Any help would be appreciated! Here is the code am working on.
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()
Just Uncomment Or Delete The Decorator Function Line, The Program Will Start Working And I Don’t Know Why But There is something wrong with gooey decorator!
The author also suggests turning off the decorator while debugging.
Decorator Is Used For Change The Functionality Of A Function So To Change The Program Name And Program Description Go To Directory Where It Has Installed And Change The Default Program Name, Description With Yours.