I need a way to make a gtk.TextView ignore mouse clicks in a pygtk GUI.
I have set the 'editable' property to false to prent user input, but it still responts to mouse clicks.
This textview displays some output from other commands, so if the user clicks anywhere on it, it moves the cursor to the clicked location. I need to avoid that.
I need something similar to the set_property('sensitive', False) results, but without graying out the widget. It just needs to sit there and ignore all kinds of user input.
Anyone have any ideas how to accomplish this?
Thanks in advance.
What you did is better for your purposes. For future reference, though, if you actually wanted to just block clicking, you would want to connect the TextView
to button-press-event
like so:
tview.connect('button-press-event', tviewClicked)
and define the handler function so that it returns True
:
def tviewClicked(widget,event):
return True
Returning True from a handler function tells GTK not to pass it on to anything else, so the click never gets sent to the TextView
. The user won't be able to click on it any more.
I know this is an old question, but maybe it'll help someone else who comes to this page.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With