Buy Me a Coffee? Your support is much appreciated!
PayPal Me: https://www.paypal.me/jiejenn/5
Venmo: @Jie-Jenn
Source Code:
import sys from PyQt5.QtWidgets import QApplication, QWidget, QPushButton, QVBoxLayout, QTextBrowser from PyQt5.QtGui import QTextCursor class AppDemo(QWidget): def __init__(self): super().__init__() self.resize(600, 400) layout = QVBoxLayout() self.button = QPushButton('Demo', clicked=self.generateContent) layout.addWidget(self.button) self.textBrowser = QTextBrowser() self.textBrowser.setOpenExternalLinks(True) self.textBrowser.setStyleSheet('font-size: 30px;') layout.addWidget(self.textBrowser) self.setLayout(layout) def generateContent(self): self.textBrowser.moveCursor(QTextCursor.Start) self.textBrowser.append('Hello World') self.textBrowser.append('<a href=http://google.com>Google</a>') if __name__ == '__main__': app = QApplication(sys.argv) demo = AppDemo() demo.show() sys.exit(app.exec_())