A
André
Hi everyone,
I'd be interested in hearing suggestions as to the "best" way to drive
a Python program step by step from another application.
Details:
---------
I have implemented a "Robot" that can be programmed by a user to
perform certain actions. (see Reeborg below for a simple javascript-
based example).
For example, part of a typical program might look like:
=====
move()
turn_left()
move()
for i in range(2):
move()
....
===
I had this working in a desktop based application (see RUR-PLE below),
where the user program was executed via
exec user_code in MyGlobals
and MyGlobals contained appropriate definitions. Having it all
included in a single Python program, I could include time delays in
each instruction [such as move()], so that the user could stop the
program running by clicking on a button, etc., and then step through a
series of instructions one-by-one, and/or resume the automatic
execution.
Now, I want to reproduce this behaviour in a browser based application
(see Crunchy below).
So, I'd like the Python back end to send information (at set
intervals) to the browser and be able to react to input from the
browser (say, a user pressing a "pause" button).
I could try to reimplement the method I used for RUR-PLE some 3 years
ago but I know enough now to realize that the method I used was rather
"inelegant", but don't know enough to see a better way off-hand.
Any suggestion would be appreciated.
Cheers,
André
Reeborg: http://reeborg.world.googlepages.com/reeborg.html
Crunchy: http://code.google.com/p/crunchy/
RUR-PLE: http://rur-ple.sourceforge.net/
I'd be interested in hearing suggestions as to the "best" way to drive
a Python program step by step from another application.
Details:
---------
I have implemented a "Robot" that can be programmed by a user to
perform certain actions. (see Reeborg below for a simple javascript-
based example).
For example, part of a typical program might look like:
=====
move()
turn_left()
move()
for i in range(2):
move()
....
===
I had this working in a desktop based application (see RUR-PLE below),
where the user program was executed via
exec user_code in MyGlobals
and MyGlobals contained appropriate definitions. Having it all
included in a single Python program, I could include time delays in
each instruction [such as move()], so that the user could stop the
program running by clicking on a button, etc., and then step through a
series of instructions one-by-one, and/or resume the automatic
execution.
Now, I want to reproduce this behaviour in a browser based application
(see Crunchy below).
So, I'd like the Python back end to send information (at set
intervals) to the browser and be able to react to input from the
browser (say, a user pressing a "pause" button).
I could try to reimplement the method I used for RUR-PLE some 3 years
ago but I know enough now to realize that the method I used was rather
"inelegant", but don't know enough to see a better way off-hand.
Any suggestion would be appreciated.
Cheers,
André
Reeborg: http://reeborg.world.googlepages.com/reeborg.html
Crunchy: http://code.google.com/p/crunchy/
RUR-PLE: http://rur-ple.sourceforge.net/