Renamed figure to shape and modified sendKeyEvent