from World import *
from RemoteObject import *

class RemoteTurtleWorld(TurtleWorld, RemoteObject):
    def __init__(self, name=None):
        if name == None:
            name = 'RemoteTurtleWorld%d' % id(self)
            print name
        TurtleWorld.__init__(self)
        RemoteObject.__init__(self, name)

    def quit(self):
        self.stopLoop()
        self.join()
        World.quit(self)

    def run_message(self, message):
        self.inter.run_code(message, '<user-provided code>')

def main(script, name=None, *args):
    world = RemoteTurtleWorld(name)
    world.threadLoop()
    world.mainloop()
 
 
# if we are running the program as a script (as opposed to
# importing it, we should call main(), passing along
# the command-line arguments
if __name__ == '__main__':
    main(*sys.argv)

