I am helping a friend with some Python code. I am making a menu, and I would like to make the dimensions customizable. I have been playing with argparse, and I have had no luck. My idea is to have menu.py
default to 80*24, and have menu.py 112 84
set to 112*84. I have my current code here:
import argparse
args = argparse.ArgumentParser(description='The menu')
width = length = 0
args.add_argument('--width', const=80, default=80, type=int,
help='The width of the menu.', nargs='?', required=False)
args.add_argument('--length', const=24, default-24, type=int,
help='The length of the menu.', nargs='?', required=False)
inpu = args.parse_args()
width = inpu.width
length = inpu.length
print(width)
print(length)
How can I do this with argparse
?