Can WindowXML consume actions?

I have a python script which displays a window via WindowXML.

I’d like to capture various key presses to trigger certain actions. However, if I listen for, say, ACTION_VOLUME_UP, I still get Kodi adjusting its own volume.

Is there a way for my window to consume the action so Kodi’s default behaviours are ignored while my window is open?

Sorry if I’ve explained that badly.