You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

22 lines
639 B

  1. import sys
  2. import argparse
  3. from gooey import Gooey
  4. sys.argv.extend(['1', '2', '3', '4', '--sum'])
  5. # @Gooey
  6. def main():
  7. parser = argparse.ArgumentParser(description='Process some integers.')
  8. parser.add_argument('integers', metavar='N', type=int, nargs="+",
  9. help='an integer for the accumulator')
  10. parser.add_argument('--sum', dest='accumulate', action='store_const',
  11. const=sum, default=max,
  12. help='sum the integers (default: find the max)')
  13. args = parser.parse_args()
  14. print args.accumulate(args.integers)
  15. if __name__ == '__main__':
  16. main()