pip install Gooey
python
import argparse
from gooey import Gooey, GooeyParser
python
@Gooey(program_name="My File Reader")
def parse_args():
parser = GooeyParser(description="A simple file reader")
parser.add_argument("file", help="Path to the file")
return parser.parse_args()
python
def read_file(file):
try:
with open(file, "r") as f:
content = f.read()
print(content)
except FileNotFoundError:
print("File not found")
python
def main():
args = parse_args()
read_file(args.file)
if __name__ == "__main__":
main()