O
O
Oleg Wock2014-06-08 22:25:27
Python
Oleg Wock, 2014-06-08 22:25:27

How to insert image in QTextEdit

I'm making a small text editor, but I have a problem: I can't insert an image into QTextEdit. Tried to embed using html tag like this:

def insertImage():
    filePath = QtGui.QFileDialog.getOpenFileName(
            None,
            "Select an image",
            ".",
            "Image Files(*.png *.gif *.jpg *jpeg *.bmp)"
        )

    if filePath:
        window.textarea.insertHtml('<img scr="{0}">' .format(filePath) )

But only an icon in the form of a small leaf is added, as if it does not find the image. Tell me, please, what is the problem.

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question