def __init__(self, canvas, namespace=None, vars=None):
Grammar.__init__(self, canvas, namespace=namespace, vars=vars)<EOL>canvas.set_bot(self)<EOL>self._autoclosepath = True<EOL>self._path = None<EOL>if self._input_device:<EOL><INDENT>for key_name, value in self._input_device.get_key_map().items():<EOL><INDENT>self._namespace[key_name] = value<EOL>setattr(self, key_name, value)<EOL><DEDENT><DEDENT>self._canvas.size = None<EOL>self._frame = <NUM_LIT:1><EOL>self._set_initial_defaults()<EOL>
:param canvas: Canvas implementation for output.
:param namespace: Optionally specify a dict to inject as namespace
:param vars: Optional dict containing initial values for variables