Disable right click in GTK window

混江龙づ霸主 提交于 2019-12-25 12:10:38

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!