code: def init_widget(self):
          
          w = self.window
          d = self.declaration
          self.set_background_color(d.background_color)
          self.set_touchable(d.touchable)
          self.set_outside_touchable(d.outside_touchable)
  
          # Listen for events
          w.setOnDismissListener(w.getId())
          w.onDismiss.connect(self.on_dismiss)
          super(AndroidPopupWindow, self).init_widget()
docs: Set the listeners