[prev in list] [next in list] [prev in thread] [next in thread] 

List:       pykde
Subject:    Re: [PyQt] Cannot Show SVG with QWebEngineView
From:       Vincent Vande Vyvre <vincent.vande.vyvre () telenet ! be>
Date:       2019-10-16 22:26:18
Message-ID: 1fa9e800-10a1-52b6-0e37-b08da5288bad () telenet ! be
[Download RAW message or body]

[Attachment #2 (multipart/alternative)]


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@riverbankcomputing.com
> https://www.riverbankcomputing.com/mailman/listinfo/pyqt

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

/
/

Vincent


[Attachment #5 (text/html)]

<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>


[Attachment #6 (text/plain)]

_______________________________________________
PyQt mailing list    PyQt@riverbankcomputing.com
https://www.riverbankcomputing.com/mailman/listinfo/pyqt


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic