chriskiehl / GooeyExamples

Example programs to Demonstrate Gooey's functionality
MIT License
304 stars 73 forks source link

Richtext crashes #39

Open tianshuo opened 10 months ago

tianshuo commented 10 months ago

Describe the bug

Traceback (most recent call last):
  File "/Users/admin/sources/combiner/combiner.py", line 145, in <module>
    main()
  File "/usr/local/lib/python3.11/site-packages/gooey/python_bindings/gooey_decorator.py", line 128, in inner2
    return payload(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/admin/sources/combiner/combiner.py", line 136, in main
    args = parser.parse_args()
           ^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/gooey/python_bindings/gooey_parser.py", line 125, in parse_args
    return self.parser.parse_args(args, namespace)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/gooey/python_bindings/gooey_decorator.py", line 123, in run_gooey
    application.run(build_spec)
  File "/usr/local/lib/python3.11/site-packages/gooey/gui/application.py", line 21, in run
    app, _ = build_app(build_spec)
             ^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/gooey/gui/application.py", line 27, in build_app
    return _build_app(build_spec, app)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/gooey/gui/application.py", line 40, in _build_app
    gapp = GooeyApplication(merge(build_spec, imagesPaths))
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/gooey/gui/containers/application.py", line 47, in __init__
    self.console = Console(self, buildSpec)
                   ^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/gooey/gui/components/console.py", line 21, in __init__
    self.textbox = RichTextConsole(self)
                   ^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/gooey/gui/components/widgets/richtextconsole.py", line 45, in __init__
    self.esc = colored.style.ESC
               ^^^^^^^^^^^^^^^^^
AttributeError: 'function' object has no attribute 'ESC'

To Reproduce Steps to reproduce the behavior:

  1. Using @Gooey(progress_regex=r"^Progress: (?P<current>\d+)/(?P<total>\d+)$", progress_expr="current / total * 100",show_restart_button=False, richtext_controls=True)
  2. Run program: see Error above
  3. Removing richtext_controls=True fixes it, but this isn't expected behavior.

Expected behavior

  1. No bug at all.

Desktop (please complete the following information):

chrakts commented 2 months ago

Python 3.11.5 Gooey Version 1.0.8.1 Windows 11 For me it is the same behaviour: Using richtext_controls=True produces the error message. Using richtext_controls = False does not produce the error, but the styles are without effect.