This library allows you to use python in B4J (based on jython)
Similar to the jInvokeNashorn library in jScriptEngine topic
Can use a string as a script or a file in Objects/scripts/
Attached is the library - jPython.zip
test b4j project - python testing.zip
Simple examples are included in the source.
The python zip is a tad large so won't upload
Here's a link to it - Removed
Added a new example py script - it shows how to
a, interact with b4j
b, create new controls and add to mainform (either by passing mainform.rootpane or not)
c, add event handling for controls (calls a routine in the b4j app)
(Obviously if your app package is not b4j.example.main - edit accordingly)
jPython(no jython jar).jar is just the library without the jython.jar included
if you use that you need to d/load 'jython-standalone-2.7.0.jar' (google jython) and place in libraries folder.
**** see post 7 ******
****** UPDATE 11/12/15
jPython lib
This needs the full path to the script file
py.InitInvocable("myscript.py") becomes py.InitInvocable("./myscript.py") if the script is in current directory
The library will no longer look in /objects/scripts for the file
Added library source
*** Added jython lib.zip
Requires jython.jar to be added with #AdditionalJars
(currently only works in debug mode - still testing to find reason why)
Ok - sorted it now to work in release
There is a new function - pythonLibraries - point this to the library folder
usually C:/jython2.7.0/lib
Latest version is 1.6
Similar to the jInvokeNashorn library in jScriptEngine topic
Can use a string as a script or a file in Objects/scripts/
Attached is the library - jPython.zip
test b4j project - python testing.zip
Simple examples are included in the source.
The python zip is a tad large so won't upload
Here's a link to it - Removed
Added a new example py script - it shows how to
a, interact with b4j
b, create new controls and add to mainform (either by passing mainform.rootpane or not)
c, add event handling for controls (calls a routine in the b4j app)
(Obviously if your app package is not b4j.example.main - edit accordingly)
jPython(no jython jar).jar is just the library without the jython.jar included
if you use that you need to d/load 'jython-standalone-2.7.0.jar' (google jython) and place in libraries folder.
**** see post 7 ******
****** UPDATE 11/12/15
jPython lib
This needs the full path to the script file
py.InitInvocable("myscript.py") becomes py.InitInvocable("./myscript.py") if the script is in current directory
The library will no longer look in /objects/scripts for the file
Added library source
*** Added jython lib.zip
Requires jython.jar to be added with #AdditionalJars
Ok - sorted it now to work in release
There is a new function - pythonLibraries - point this to the library folder
usually C:/jython2.7.0/lib
Latest version is 1.6
Attachments
Last edited: