, ; .html .css , python script; script .
, python/PyQt4, , - - , setHtml.
:

setHtml, , c3, file:// + . (EDIT: , , " arora ( QtWebKit), , , , -." "
script :
$ lsb_release
Description: Ubuntu 11.04
Codename: natty
$ apt-show-versions -r python-qt4
python-qt4/natty uptodate 4.8.3-2
python-qt4-dbus/natty uptodate 4.8.3-2
$ apt-show-versions -r libqtwebkit4
libqtwebkit4/natty uptodate 2.1~really2.0.2-0ubuntu1
$ python
Python 2.7.1+
script:
qtwebkit-test.py
import sys
import os
from PyQt4 import QtCore
from PyQt4 import QtGui
from PyQt4 import QtWebKit
global htmltext
def GenerateFiles():
global htmltext
print "GenerateFiles running"
csstext = """
body {
background-color: #058;
margin: 0px;
color: red;
}
"""
css_file = open("test.css", "w")
css_file.write(csstext)
css_file.close()
htmltextTop = """
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8">
"""
htmltextBottom = """
<title>qtwebkit-test</title>
</head>
<body>
<h1>HEADING</h1>
<p>Just to test ....</p>
<p>.... and test some more</p>
</body>
</html>
"""
cssopen = '<link rel="stylesheet" type="text/css" href="'
cssclose = '">'
cssfile = "test.css"
cssline = cssopen + cssfile + cssclose
htmltext = htmltextTop + cssline + htmltextBottom
html_file = open("test.html", "w")
html_file.write(htmltext)
html_file.close()
def main():
global htmltext
GenerateFiles()
qApp = QtGui.QApplication(sys.argv)
webView = QtWebKit.QWebView()
webView.setHtml(htmltext)
webView.show()
webView.resize(500, 400)
webView.setWindowTitle(__file__)
sys.exit(qApp.exec_())
if __name__ == "__main__":
main()