How to open a dialog that shows messages asynchronously?

I’m creating an add-on that runs Python code that requires some few minutes. I would like to let the user know of the progress of execution, so I’m planning to print some informative messages.

I want to do something like the Ubuntu installer where messages are printed (see images below) (I don’t need to show complex things like a progress bar or remaining time, as the Ubuntu installer does, I just want to print simple messages)

Does anyone know an open-source add-on that does something like this so that I can inspect the source code and edit it to my needs? If not, do you know how to do this? Could you point me to the right direction?


I just learned that when importing cards, Anki uses showText to display the information of all the cards that were imported. This message isn’t asynchronous, but it does the job of showing information to the user. I’m going to share some relevant information as I’m going to use for the moment as I’m not very familiar with multithreading (I hope I can learn it in the future).

The following code block contains a minimal working example of using showText (just in case anyone is curious).

import aqt

def my_function():
  very_long_message = ""
  for i in range(1, 100):
    very_long_message = very_long_message + f"{i}\n"

my_action = aqt.qt.QAction("My new action",

Anki defines the class Importer and that class has an attribute called log which is a list (see code) and information is appended to that list (see code).

One way you can do this is to move long-running tasks to a separate thread, then report progress to the main thread, which will take care of updating the UI.

See Background Operations - Writing Anki Add-ons


This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.