Embed Jython
if( ((String)langCombo.getSelectedItem()).equalsIgnoreCase("python") ) {
SwingUtilities.invokeLater(() -> {
try {
PythonInterpreter pythonScript;
System.setProperty("python.import.site","false");
pythonScript = new PythonInterpreter();
pythonScript.set("instance", this);
pythonScript.exec("def write(text): instance.outputPrint(text)\n");
pythonScript.exec("def writeln(text): instance.outputPrintLn(text)\n");
outputPrintLn("<START Python>");
pythonScript.exec(textTab.getSelectedTextView().getText());
outputPrintLn("<END Python>");
} catch (Exception e) {
e.printStackTrace();
outputPrintLn("error\n" + e.getMessage());
}
});
}
댓글 없음:
댓글 쓰기