[PyQt] Cannot Show SVG with QWebEngineView

Tong Zhang warriorlance at gmail.com
Wed Oct 16 21:51:07 BST 2019


Hello,

I'm trying to use QWebEngineView to display a SVG image, but just got the
empty, below is the code:
filename: show_svg.py

from PyQt5.QtWidgets import QApplication
         from PyQt5.QtCore import QUrl
                  from PyQt5.QtWebEngineWidgets import QWebEngineView

         import sys


app = QApplication(sys.argv)
svg = QUrl(sys.argv[1])
view = QWebEngineView()
view.load(svg)
view.show()

sys.exit(app.exec_())


Please find attached SVG file, the testing command is 'python3 show_svg.py
test1.svg'. Thanks for your help.

Tong
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://www.riverbankcomputing.com/pipermail/pyqt/attachments/20191016/4a3e213d/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: test1.svg
Type: image/svg+xml
Size: 2634 bytes
Desc: not available
URL: <https://www.riverbankcomputing.com/pipermail/pyqt/attachments/20191016/4a3e213d/attachment.svg>


More information about the PyQt mailing list