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.

26 lines
727 B

  1. #!/usr/bin/env python
  2. # -*- coding: utf-8 -*-
  3. from __future__ import unicode_literals
  4. from __future__ import print_function
  5. import sys
  6. from time import sleep
  7. from gooey import Gooey, GooeyParser
  8. @Gooey(progress_regex=r"^progress: (?P<current>\d+)/(?P<total>\d+)$",
  9. progress_expr="current / total * 100")
  10. def main():
  11. parser = GooeyParser(prog="example_progress_bar_3")
  12. parser.add_argument("steps", type=int, default=15)
  13. parser.add_argument("delay", type=int, default=1)
  14. args = parser.parse_args(sys.argv[1:])
  15. for i in range(args.steps):
  16. print("progress: {}/{}".format(i+1, args.steps))
  17. sys.stdout.flush()
  18. sleep(args.delay)
  19. if __name__ == "__main__":
  20. sys.exit(main())