Hello. I am very new to python and drpython, but the program seems great. There is one thing I would like it to do though. It is useful for me to interact with python from drpython by highlighting lines of code and sending them to the python shell for evaluation (using a shortcut key). I want to do this without sending an entire file and without closing and opening a new python shell every time I do it. That way, variables in the python shell will be persistent. Lastly, I would like control to be brought back to the code in drpython after evaluation is completed.
I think this would be an easy script, but Im just not sure how to write it. I would like to try. I would guess that the first line would be:
and then the next lines would have some pieces of the following:
self.txtPrompt.pid = wx.Execute(command, wx.EXEC_ASYNC, self.txtPrompt.process)
But I am not sure just how it should be written. Am I correct that this would be a simple little script to do a quick and dirty job?
Hey, This is one way to do it in a script:
seltext = DrDocument.GetSelectedText() + '\n'
This works if you start up the python interpreter first.
When you highlight text, it will automatically run it, then return the focus to the document.
To run the interpreter from the script:
Both arguments are optional.