[PyQt] PyQt, QWebView, SVG Rendering Problem

Christoph Burgmer chrislb at gmx.de
Sun Jan 25 04:07:23 GMT 2009


Am Sunday, 25. January 2009 schrieb David Boddie:
> On Sat Jan 24 04:59:26 GMT 2009, Christoph Burgmer wrote:
> > It doesn't work for me with PyQt 4.4.2. I'm using setHtml() not load().
> > I can currently not update to a newer version, so I cannot verify if that
> > is a issue in 4.4.2 solved in 4.4.3.
>
> It seems to work for me. This is what I tried:
>
> from PyQt4.QtGui import *
> from PyQt4.QtWebKit import *
> from PyQt4.QtCore import QUrl
> u = QUrl("file:///tmp/SVG_test/svg_test.xhtml")
> app = QApplication([])
> w = QWebView()
> w.setHtml(open("/tmp/SVG_test/svg_test.xhtml").read(), u)
> w.show()

Thanks for the example. The second parameter being the QUrl giving the base 
address is needed for referencing even absolut paths, something that I missed.

I thought using a .svg would be nice, removing the conversion to .png after an 
update, but now I'm stuck with getting the .svg scaled according to the size 
given. Two online proposed solutions further I am still stuck with 100%.

Anyway, nice to see that .svg is slowly making it to the browsers.

Christoph
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.riverbankcomputing.com/pipermail/pyqt/attachments/20090125/76e8f75f/attachment.html


More information about the PyQt mailing list