Custom event : TypeError: 'NoneType' object is not subscriptable
The error is thrown in the kivy parser for sure, which suggests the error is in the string you're trying to load. It looks like an indentation issue in the string.
If the example has been taken from here there's something funky about the indentation level mixing in that snippet that the GitHub code formatter might be hiding. If your indentation is like on that page, try copying the code snippet you've posted exactly as it's formatted here, and see if that fixes things.