[Pydev-users] [Users] RE: How to write commands to pydev console
Brought to you by:
fabioz
|
From: SourceForge.net <no...@so...> - 2011-05-25 19:35:46
|
The following forum message was posted by at http://sourceforge.net/projects/pydev/forums/forum/293649/topic/4498666: FYI, This is what i did to solve this problem and it seems to work (I created the console first, but there must be a way to get the console after it has been created). [code] final ICallback<Object, InterpreterResponse> onResponseReceived = new ICallback<Object, InterpreterResponse>(){ public Object call(final InterpreterResponse arg){ //When we receive the response, we must handle it in the UI thread. RunInUiThread.async(new Runnable(){ public void run(){ } }); return null; } }; try { PydevConsoleFactory factory = new PydevConsoleFactory(); PydevConsoleInterpreter interp = PydevConsoleFactory .createDefaultPydevInterpreter(); factory.createConsole(interp, "x=1;print x\n"); interp.exec ("y=2\n", onResponseReceived); } catch (Exception e) { e.printStackTrace(); }[/code] Brian |