SendText icon indicating copy to clipboard operation
SendText copied to clipboard

SendText with iPython Qtconsole

Open shaunpatel opened this issue 11 years ago • 1 comments

Any idea on the best way to insert code into an iPython Qtconsole window. I have come up with a little hack, by using some AppleScript in the SendText.py function but it is really clunky. I am really unfamiliar with AppleScript.

        subprocess.call(['osascript', '-e', 'set the clipboard to "' + selection + '"',
                '-e', 'tell application "Python" to activate',
                '-e', 'tell application "System Events"',
                '-e', 'tell process "iPython"',
                '-e', 'delay 0.1',
                '-e', 'keystroke "v" using command down',
                '-e', 'keystroke return',
                '-e', 'keystroke return',
                '-e', 'keystroke return',
                '-e', 'end tell',
                '-e', 'end tell',
                '-e', 'tell application "System Events"',
                '-e', 'tell process "Sublime Text"',
                '-e', 'set frontmost to true',
                '-e', 'end tell',
                '-e', 'end tell'])

shaunpatel avatar Oct 26 '14 22:10 shaunpatel

Possible to send this to the iPython qtconsole directly through zeroMQ?

shaunpatel avatar Nov 07 '14 02:11 shaunpatel