How to capture output of Python’s interpreter and show in a Text widget?

I have a program in Python with PyQt, designed to run on Windows.
This program makes a lot of operations and prints a lot of info.
But as I want to freeze it and don’t want the prompt screen to appear, I want that all that info appears in the main application, in a QTextEdit or so.
How can i make the program work so it gets the output from the interpreter and shows it on the textEdit at the same time, just like it does on the real interpreter?