Created
May 20, 2012 12:44
-
-
Save empr/2757993 to your computer and use it in GitHub Desktop.
PySide QWebView with jquery
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # 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