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.

27 lines
748 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: (\d+)/(\d+)$",
  9. progress_expr="x[0] / x[1] * 100",
  10. disable_progress_bar_animation=False)
  11. def main():
  12. parser = GooeyParser(prog="example_progress_bar_2")
  13. parser.add_argument("steps", type=int, default=15)
  14. parser.add_argument("delay", type=int, default=1)
  15. args = parser.parse_args(sys.argv[1:])
  16. for i in range(args.steps):
  17. print("progress: {}/{}".format(i+1, args.steps))
  18. sys.stdout.flush()
  19. sleep(args.delay)
  20. if __name__ == "__main__":
  21. sys.exit(main())