问题
I would disable right click (and so context menu) in a Python GTK window (pyGTK) where inside is located a "window" pyWebKitGtk.
Someone can help me writing some lines of code?
I think that would better delete event directly in pyGTK but if you know how don't show context menu in pyWebKitGtk is good anyway.
TNK TNK TNK
Realy cutted code:
import gtk
import webkit
window = gtk.Window(gtk.WINDOW_TOPLEVEL)
window.connect("destroy", gtk.main_quit)
browser = webkit.WebView()
browser.open("http://www.stackoverflow.com")
scroller = gtk.ScrolledWindow()
scroller.add(browser)
window.add(scroller)
window.show_all()
gtk.main()
回答1:
You can use the enable-default-context-menu setting:
webview.props.settings.props.enable_default_context_menu = False
来源:https://stackoverflow.com/questions/4445065/disable-right-click-in-gtk-window