Skip to content

Instantly share code, notes, and snippets.

@empr
Created May 20, 2012 12:44
Show Gist options
  • Select an option

  • Save empr/2757993 to your computer and use it in GitHub Desktop.

Select an option

Save empr/2757993 to your computer and use it in GitHub Desktop.
PySide QWebView with jquery
# coding: utf-8
import os
import sys
import site
site.addsitedir('/usr/local/lib/python2.7/site-packages')
from PySide import QtCore, QtGui, QtWebKit
html = """
<!doctype html>
<html>
<body>
<script src="jquery-1.7.2.min.js"></script>
<script>
$(function() {
alert("init");
});
</script>
</body>
</html>
"""
app = QtGui.QApplication(sys.argv)
view = QtWebKit.QWebView()
base = 'file://%s/' % os.path.dirname(os.path.abspath(__file__))
view.setHtml(html, base)
view.show()
sys.exit(app.exec_())
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment