<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  </head>
  <body text="#000000" bgcolor="#FFFFFF">
    <div class="moz-cite-prefix">Le 16/10/19 à 22:51, Tong Zhang a
      écrit :<br>
    </div>
    <blockquote type="cite"
cite="mid:CABUYRu52YCVTTnorze9BZKN+hDw0fUyibmHHL1iJ1uOq8jBCUA@mail.gmail.com">
      <meta http-equiv="content-type" content="text/html; charset=UTF-8">
      <div dir="ltr">
        <div>Hello,</div>
        <div><br>
        </div>
        <div>I'm trying to use QWebEngineView to display a SVG image,
          but just got the empty, below is the code:</div>
        <div>filename: show_svg.py</div>
        <div><br>
        </div>
        <div>
          <pre style="color:rgb(0,0,0);background:rgb(255,255,255) none repeat scroll 0% 0%"><span style="color:rgb(128,0,0);font-weight:bold">from</span> PyQt5<span style="color:rgb(128,128,48)">.</span>QtWidgets <span style="color:rgb(128,0,0);font-weight:bold">import</span> QApplication                                        
<span style="color:rgb(128,0,0);font-weight:bold">from</span> PyQt5<span style="color:rgb(128,128,48)">.</span>QtCore <span style="color:rgb(128,0,0);font-weight:bold">import</span> QUrl                                                   
<span style="color:rgb(128,0,0);font-weight:bold">from</span> PyQt5<span style="color:rgb(128,128,48)">.</span>QtWebEngineWidgets <span style="color:rgb(128,0,0);font-weight:bold">import</span> QWebEngineView                             
                                                                                
<span style="color:rgb(128,0,0);font-weight:bold">import</span> sys                                                                      
                                                                                
                                                                                
app <span style="color:rgb(128,128,48)">=</span> QApplication<span style="color:rgb(128,128,48)">(</span>sys<span style="color:rgb(128,128,48)">.</span>argv<span style="color:rgb(128,128,48)">)</span>                                                    
svg <span style="color:rgb(128,128,48)">=</span> QUrl<span style="color:rgb(128,128,48)">(</span>sys<span style="color:rgb(128,128,48)">.</span>argv<span style="color:rgb(128,128,48)">[</span><span style="color:rgb(0,140,0)">1</span><span style="color:rgb(128,128,48)">]</span><span style="color:rgb(128,128,48)">)</span>                                                         
view <span style="color:rgb(128,128,48)">=</span> QWebEngineView<span style="color:rgb(128,128,48)">(</span><span style="color:rgb(128,128,48)">)</span>                                                         
view<span style="color:rgb(128,128,48)">.</span>load<span style="color:rgb(128,128,48)">(</span>svg<span style="color:rgb(128,128,48)">)</span>                                                                  
view<span style="color:rgb(128,128,48)">.</span>show<span style="color:rgb(128,128,48)">(</span><span style="color:rgb(128,128,48)">)</span>                                                                     
                                                                                                                                                      
sys<span style="color:rgb(128,128,48)">.</span>exit<span style="color:rgb(128,128,48)">(</span>app<span style="color:rgb(128,128,48)">.</span>exec_<span style="color:rgb(128,128,48)">(</span><span style="color:rgb(128,128,48)">)</span><span style="color:rgb(128,128,48)">)</span></pre>
        </div>
        <div><br>
        </div>
        <div>Please find attached SVG file, the testing command is
          'python3 show_svg.py test1.svg'. Thanks for your help.</div>
        <div><br>
        </div>
        <div>Tong<br>
        </div>
      </div>
      <br>
      <fieldset class="mimeAttachmentHeader"></fieldset>
      <pre class="moz-quote-pre" wrap="">_______________________________________________
PyQt mailing list    <a class="moz-txt-link-abbreviated" href="mailto:PyQt@riverbankcomputing.com">PyQt@riverbankcomputing.com</a>
<a class="moz-txt-link-freetext" href="https://www.riverbankcomputing.com/mailman/listinfo/pyqt">https://www.riverbankcomputing.com/mailman/listinfo/pyqt</a>
</pre>
    </blockquote>
    <p>Try with <i>QUrl.fromLocalFile(sys.argv[1])</i></p>
    <p><i><br>
      </i></p>
    <p>Vincent<br>
    </p>
  </body>
</html>