Bonsai python Scripting Help #2027
-
Hello Bonsai Comunity, I am attempting to use a simple script to track a mouse in a maze. I would then like to send the x,y coordinates to a python script to calculate the distance from the center of the maze to the mouses x,y position. I have been through the documentation and am having a very difficult time understanding how to pass the x,y position from bonsai to python. I have attached my work flow. The center of the maze is calculated in a separate bonsai work flow and written to a CSV file. Reading that csv in python each frame would work, however if i could only read it once in bonsai and pass the maze canter x,y and mouse center x,y to the python script that would be idea. my over all goal is as the mouse moves in each frame the python script will recalculate the distance between the center and the mouse x,y position. Im sorry to ask such a beginner question but have not had much luck with the documentation it feels i am missing some conceptual information |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 3 replies
-
Solved: Here is a brief run down for getting python3 working with bonsai on windows 11
*python transform is in many doc/examples but doesn't appear to be supported in the standard python scripting library (maybe in iron python? idk) Most useful sources: Bonsai crash course -> https://www.youtube.com/watch?v=srcqJXd6Vz4 |
Beta Was this translation helpful? Give feedback.
Solved: Here is a brief run down for getting python3 working with bonsai on windows 11
Use CreateRuntime, no connections, leave PythonHome blank, windows will auto select the path, select your ScriptPath and put your .py file in the same folder as the bonsai program
Exec to execute python functions defined in your .py file. Leave Module blank and Script put function_to_run() where function_to_run() is defined in th .py file
ObserveOnGIL with each Set (and I would assume get) operation
*python transform is in many doc/examples but doesn't appear to be supported in the standard python scripting library (maybe in iron python? idk)
Most useful sources: Bonsai crash course -> https://w…