Text display with Progress Bar

I love how easy it is to add a RealtiveProgressBar to my python scripts. When KL is running a long DRC check it displays a nice text box with a running list of the tasks completed. Is it possible to replicate this behavior from a script? Or do I have to create a stand-alone dialog box using Qt?


  • edited May 2023

    @yanoff The DRC system is itself a script, so that is possible.

    The key is "AbstractProgress" which is a progress reporter without a value but while it is active, log messages will be collected and sent to the progress report area.

    Here is some code:

    # while "progress" is alive, log messages are sent to the progress report area:
    progress = pya.AbstractProgress("A test")
    for i in range(0, 10000000):
      if i % 10000 == 0:
        pya.Logger.info("i is " + str(i))
    # stop showing log messages (they are still shown in the log viewer)
    progress = None

    While trying that I noticed that the "Cancel" button does not have an effect. I will try to debug that problem.


  • Very cool! I'll try this out when I have a chance.

Sign In or Register to comment.