def snap_switch_to_widget(self):
        """Positions switch relative to the widget"""
        value = getattr(self.widget.rect, self.widget_coord_name)

        setattr(self.rect, self.switch_coord_name, value)

        self.rect.clamp_ip(SCREEN_RECT)
Positions switch relative to the widget
nodezator/hideswitch.py