Changes between Version 2 and Version 3 of EmbeddedInterpreter
- Timestamp:
- 11/22/08 23:07:49 (4 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
EmbeddedInterpreter
v2 v3 3 3 I've embedded python into our sampler application to create a control-rate scripting language. The python code is run with (*gasp*) real-time priority in the audio thread, and performs quite well, as long as no one does a while True: pass. There were a ton of hurdles for embedding the app into the program, but there was also very little information available on the internets to help, so I thought I'd try to write some stuff down. Go Google. 4 4 5 There are two cases that I can think of for embedding python into your application. The first one is to provide a scripting interface to your application, which will allow you to write and run scripts from right inside your application. Usually you will include a text editor and provide a special API to your scripts to access to your application engine, or something like that. This is what I did. 6 7 The second case is if you want to actually write some of your application in python. An example would be that you would write one of the gui widgets in python, and set the widget to be a child window of your application's main window - interesting stuff. This means bundling those python scripts with your app, either on the filesystem or by embedding them into the exe. Embedding the code as binary data in your exe is obviously the sexier choice, since it keeps deployment and portability simple. 8 5 9 = Contents = 6 10 7 * [wiki:EmbeddedInterpreter/BasicConcepts Basic Concepts]8 11 * [wiki:EmbeddedInterpreter/RunningScripts Running Scripts] 9 12 * [wiki:EmbeddedInterpreter/EmbeddingCode Embedding Code]