import sys
from PyQt5.QtWidgets import QApplication, QMessageBox
def display_html(html_content):
app = QApplication(sys.argv)
msg_box = QMessageBox()
msg_box.setWindowTitle("HTML Display")
msg_box.setTextFormat(1) # 设置文本格式为 HTML
msg_box.setText(html_content)
msg_box.exec_()
if __name__ == "__main__":
html_content = '''
<!DOCTYPE html>
<html>
<head>
<title>Display HTML</title>
</head>
<body>
<h1>Hello, Python!</h1>
<p>This is HTML content displayed using PyQt5.</p>
</body>
</html>
'''
display_html(html_content)
pyqt 显示html网页内容
最新推荐文章于 2024-07-24 20:42:53 发布