I have a QTextBrowser Widget which is used to display hyperlinks. There are text with value assigned to them. I need to return an integer value to python variable when hyperlink is clicked.
The code snippet looks like below:
self.textWin = QTextBrowser()
self.textWin .setOpenExternalLinks(True)
index_str = '<li><a href="#" onclick="return 1">Link Text</a></li>'
self.textWin.setHtml(index_str )
The expected output for the code is the when hyperlink is clicked in the Text Window, it should return a value on click to a python variable. How should be the structure of html link attribute and the python code such that it returns a value. How do I approach this problem?
Thanks in advance.