set colour to inserplaintext qtextedit in python 1

set colour to inserplaintext qtextedit in python

edit->textCursor().insertText(text);

Here is what the above code is Doing:
1. We create a QTextEdit widget.
2. We create a QPushButton widget.
3. We create a QVBoxLayout and add the QTextEdit and QPushButton widgets to it.
4. We create a QWidget and set the QVBoxLayout as its layout.
5. We create a QMainWindow and set the QWidget as its central widget.
6. We connect the clicked signal of the QPushButton to the insert_text slot of the QTextEdit.
7. We show the QMainWindow.

Similar Posts