PyMT Black Backdrop Widget

Over the past few PyMT applications I’ve found it very useful to have a black backdrop to place over the main application area to highlight a special area of the app. The basic widget below absorbs all the key events that would normally make it to the main app. Its easy to use, just make it visible and then raise the widgets you want above it.

class Backdrop(MTWidget):
    def __init__(self, **kwargs):
        super(Backdrop, self).__init__(**kwargs) = {'bg-color': (0,0,0,.6), 'draw-background': 1}
    def on_touch_down(self, touch):
        if not self.collide_point(*touch.pos):
        return True
    def on_touch_up(self, touch):
        if touch.grab_current != self:
        return True
    def on_touch_move(self, touch):
b = Backdrop(size=(1920,1080), pos=(0,0)) #full width of app window