Skip to content

Instantly share code, notes, and snippets.

@empr
Created May 23, 2012 11:22
Show Gist options
  • Save empr/2774676 to your computer and use it in GitHub Desktop.
Save empr/2774676 to your computer and use it in GitHub Desktop.
PySide QWebView disable context menu
# coding: utf-8
import os
import sys
import site
site.addsitedir('/usr/local/lib/python2.7/site-packages')
from PySide import QtCore, QtGui, QtWebKit
class WebView(QtWebKit.QWebView):
def __init__(self, parent=None):
QtWebKit.QWebView.__init__(self, parent)
def contextMenuEvent(self, event):
# override this method and do nothing.
pass
app = QtGui.QApplication(sys.argv)
view = WebView()
view.setHtml('hello world')
view.show()
sys.exit(app.exec_())
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment