def handle_events(self):
for event in sys.stdin:<EOL><INDENT>if event.startswith('<STR_LIT:[>'):<EOL><INDENT>continue<EOL><DEDENT>name = json.loads(event.lstrip('<STR_LIT:U+002C>'))['<STR_LIT:name>']<EOL>for obj in self.loader.objects:<EOL><INDENT>if obj.output_options['<STR_LIT:name>'] == name:<EOL><INDENT>obj.on_click(json.loads(event.lstrip('<STR_LIT:U+002C>')))<EOL><DEDENT><DEDENT><DEDENT>
An event handler that processes events from stdin and calls the on_click
function of the respective object. This function is run in another
thread, so as to not stall the main thread.