[PyQt] Cannot Show SVG with QWebEngineView

Vincent Vande Vyvre vincent.vande.vyvre at telenet.be
Wed Oct 16 23:26:18 BST 2019


Le 16/10/19 à 22:51, Tong Zhang a écrit :
> 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.QtWidgetsimport  QApplication
> from  PyQt5.QtCoreimport  QUrl
> from  PyQt5.QtWebEngineWidgetsimport  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
>
> _______________________________________________
> PyQt mailing list    PyQt at riverbankcomputing.com
> https://www.riverbankcomputing.com/mailman/listinfo/pyqt

Try with /QUrl.fromLocalFile(sys.argv[1])/

/
/

Vincent

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://www.riverbankcomputing.com/pipermail/pyqt/attachments/20191017/9973ecf5/attachment.html>


More information about the PyQt mailing list