add a python code to detect button interrupt