Exemple #1
0
 def __init__(self, turtle):
     self.root = RootContext()
     self.turtle = turtle
     self.stream = StringStream()
     self.compiler = LogoCompiler(self.stream)
     for b in builtin_list:
         self.root.add_builtin(b)
Exemple #2
0
class Logo(object):
    def __init__(self, turtle):
        self.root = RootContext()
        self.turtle = turtle
        self.stream = StringStream()
        self.compiler = LogoCompiler(self.stream)
        for b in builtin_list:
            self.root.add_builtin(b)
    def run(self, text):
        self.stream.append(text)
        while self.stream:
            code = self.compiler.compile_line()
            code.run(self.root)
    def _setturtle(self, turtle):
        self._turtle = turtle
        self.root.turtle = turtle
    def _getturtle(self, turtle):
        return self._turtle
    turtle = property(_getturtle, _setturtle)