How to add image to QTextBrowser (PyQt4) using Python at a specific required point?
-
I am doing Text mining using python. I created a GUI using QT and transformed it into python snippet using PyQt4. I have QTextBrowser which indicates the sentiment index of the passage. Based on the score of the sentiment index I want to add different images into the Qtextbrowser. Below which I have added the screenshot of my tool. https://drive.google.com/file/d/0B-bFVFevEa-yMUZUMnc2UWN4T00/edit?usp=sharing Below image is the screenshot of the tool which I have created for Text mining. At the the bottom of the right hand panel , you can see the score of sentiment of the passage. Now I want to add the image on the highlighted square box area depending upon the score of the sentiment. How to add the image at the particular point in the QtextBrowser ?
-
Answer:
http://pyqt.sourceforge.net/Docs/PyQt4/qtextbrowser.html#loadResource Example: import sys from PyQt4 import QtGui, QtCore class myTextBrowser(QtGui.QTextBrowser): def loadResource (self, type, name): return QtGui.QPixmap("test.jpg") if __name__ == "__main__": app = QtGui.QApplication(sys.argv) a = myTextBrowser() a.document().setHtml("""My image :<br /><img src="test.jpg"/>""") a.show() sys.exit(app.exec_())
Siddharth.S at Stack Overflow Visit the source
Related Q & A:
- How to add a contact to a specific list?Best solution by Stack Overflow
- How to verify a JWT using python PyJWT with public key?Best solution by Stack Overflow
- How to Add Image and text at the Top of Fly Out Navigation?Best solution by Stack Overflow
- How to create a graph using python?Best solution by Stack Overflow
- How to extract a specific text from an image?Best solution by Stack Overflow
Just Added Q & A:
- How many active mobile subscribers are there in China?Best solution by Quora
- How to find the right vacation?Best solution by bookit.com
- How To Make Your Own Primer?Best solution by thekrazycouponlady.com
- How do you get the domain & range?Best solution by ChaCha
- How do you open pop up blockers?Best solution by Yahoo! Answers
For every problem there is a solution! Proved by Solucija.
-
Got an issue and looking for advice?
-
Ask Solucija to search every corner of the Web for help.
-
Get workable solutions and helpful tips in a moment.
Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.