Ignoring events, preferably with TPyDispatcher


Does anyone know how to ignore Tkinter events in a GUI through python?
I’m trying to block the default (class-level, I guess) binding of a ROOT object displayed in a GUI. I found effbot.org/tkinterbook/tkinter-e … ndings.htm which explains that the event handler needs to return the string “break” to do so. But this does not work for me when my event handler is called via TPyDispatcher. Looking at TPyDispatcher, it does return a generic PyObject* from its fCallable, so this doesn’t look hopeless.

A minimal application demonstrating the “problem” is attached.
The goal is to prevent, e.g., movement of the TGaxis drawn in the canvas using the mouse buttons.

What am I doing wrong?
Any suggestions?

Many thanks,
test_gui2.py (1.42 KB)

That all use ROOT, not use Tkinter in any means. Not look there: nothing to do. Argue ask ROOT Support how ignore event. Ignore in C++ should be same ignore in Python.

TCanvas have SetEditable. Call kFALSE.


Thanks Dominique,

Cool idea. It blocks most of the mouse actions (*).
But right-button clicks still open up a menu which can be used to edit the display.
So I still hope for a way to block those.

(*) actually, if I do it right after the parent TRootEmbeddedCanvas is constructed, it doesn’t work. But doing it later after I populate and draw the TCanvas works fine.

thanks again,