Clear Python Interactor pogrammatically

Is there any posibility to clear the Python Interactor pogrammatically within a loable module?

Thanks in advanced.
Manuel

Just curious, can you provide more information about why you want to clear the python interactor? There might be a better solution to the problem that you are trying to solve.

In my module, I have some logging infos during the process and at the start of the algorithm within the module, I want to clear the Python Interactor (the resulting logging infos) from the run before.

You could use the function ctkPythonConsole::clear()

From python, the following can be done:

slicer.app.pythonConsole().clear()

From a C++ loadable module, you would have to do something like this:

#include "qSlicerApplication.h"

// CTK includes
#include <ctkPythonConsole.h>

[...]

qSlicerApplication* app = qSlicerApplication::application();
app->pythonConsole()->clear();
2 Likes

Yes! Thats exactly what I need. Thank you so much Jean!