Not sure if is that what you want.. But that works for me.
import pygtk
> pygtk.require('2.0')
> import gtk
>
>
> class main:
>
> def __init__(self):
> self.window = gtk.Window(gtk.WINDOW_TOPLEVEL)
> self.window.set_size_request(500, 500)
> self.verticalBox = gtk.VBox()
> self.textView = gtk.TextView()
> self.textView.connect('button-press-event', self.disable_popup)
>
> self.window.add(self.verticalBox)
> self.verticalBox.add(self.textView)
>
> self.window.show_all()
>
> def disable_popup(self, widget, event):
> if event.button == 3:
> return True
>
> def main(self):
> gtk.main()
>
> if __name__ == '__main__':
> window = main()
> window.main()
>
Ignacio Rodríguez
[email protected]
SugarLabs at Facebook
<https://www.facebook.com/pages/SugarLabs/187845102582>
2014-12-22 14:29 GMT-02:00 Danilo Peixoto <[email protected]>:
> How to disable or remove default popup menu in TextView?
>
> TextView displays a default popup menu when right-click is pressed. Is it
> possible to implement the code below to not display this default popup menu?
>
> import pygtk
> pygtk.require('2.0')
> import gtk
>
> class main:
> def __init__(self):
> self.window = gtk.Window(gtk.WINDOW_TOPLEVEL)
> self.window.set_size_request(500, 500)
> self.verticalBox = gtk.VBox()
> self.textView = gtk.TextView()
>
> self.window.add(self.verticalBox)
> self.verticalBox.add(self.textView)
>
> self.window.show_all()
>
> def main(self):
> gtk.main()
>
> if __name__ == '__main__':
> window = main()
> window.main()
>
> Thanks in advance.
>
> ------------------------------
> From: [email protected]
> To: [email protected]
> Subject: How to disable or remove default popup menu in TextView?
> Date: Sat, 20 Dec 2014 18:27:22 +0000
>
>
> How to disable or remove default popup menu in TextView?
>
> TextView displays a default popup menu when right-click is pressed. Is it
> possible to implement the code below to not display this default popup menu?
>
> import pygtk
> pygtk.require('2.0')
> import gtk
>
> class main:
> def __init__(self):
> self.window = gtk.Window(gtk.WINDOW_TOPLEVEL)
> self.window.set_size_request(500, 500)
> self.verticalBox = gtk.VBox()
> self.textView = gtk.TextView()
>
> self.window.add(self.verticalBox)
> self.verticalBox.add(self.textView)
>
> self.window.show_all()
>
> def main(self):
> gtk.main()
>
> if __name__ == '__main__':
> window = main()
> window.main()
>
> Thanks in advance.
>
> _______________________________________________
> pygtk mailing list [email protected]
> http://www.daa.com.au/mailman/listinfo/pygtk
> Read the PyGTK FAQ: http://faq.pygtk.org/
>
_______________________________________________
pygtk mailing list [email protected]
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://faq.pygtk.org/