CodeMirror integration

If you look in the clone from the Duck Coding topic, you’ll see something like this:

      g = {
        'move': self.move,
        'turn_off': self.turn_off,
        'print': self.print_it,
        'turn_left': self.turn_left,
        'pick_beeper': self.pick_beeper,
        'put_beeper': self.put_beeper,
        'repeat': self.repeat,
        'front_is_clear': self.front_is_clear,
        'left_is_clear': self.left_is_clear,
        'right_is_clear': self.right_is_clear,
        'on_beeper': self.on_beeper,
        'next_to_a_beeper': self.on_beeper,
        'carries_beepers': self.carries_beepers,
      }
      
    exec(code, g)

This is providing some extra built-in functions for the coders to use. Those execute functions on my form, and those are the only places where I can do anything different from standard Python. In particular, note how I overrode the default Python print statement to call self.print_it so I could display the text in the Anvil UI.