本文主要是介绍PyQt6--Python桌面开发(7.QTextEdit多行富文本框控件),希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
QTextEdit多行富文本框控件
保存文件到本地QLine多行文本框.ui
import sys
import time
from PyQt6.QtGui import QValidator,QIntValidator
from PyQt6.QtWidgets import QApplication,QLabel,QLineEdit,QTextEdit
from PyQt6 import uic,QtGuiif __name__ == '__main__':app=QApplication(sys.argv)ui=uic.loadUi("./QLine多行文本框.ui")myTextEdit:QTextEdit=ui.textEditmyTextEdit2: QTextEdit = ui.textEdit_2myTextEdit.setTextColor(QtGui.QColor(255,0,0))myTextEdit.setTextBackgroundColor(QtGui.QColor(255,255,0))myTextEdit.setPlainText("python222")#myTextEdit.setText("<a href='http://www.baidu.com'>百度</a>")myTextEdit2.setHtml("<a href='http://www.sougou.com'>搜狗</a>")print(myTextEdit.toPlainText())print(myTextEdit2.toHtml())# myTextEdit.clear()# myTextEdit2.clear()ui.show()sys.exit(app.exec())
结果
这篇关于PyQt6--Python桌面开发(7.QTextEdit多行富文本框控件)的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!