GEdit/Python Execution Plugin?
Solution 1:
Yes, you use "external tools plugin"
As an example,
- Edit > Preferences
- Plugins
- Tick "External Tools"
Close the Preferences Window
Tools > Manage External Tools
- Click the "Add new too" icon in the bottom left
- Name it "Execute Highlighted Python Code"
- give it a keyboard shortcut
- change the input combo box to : "highlighted selection"
- change the output to : "Display in Bottom Pane"
- In the editor window for the tool, replace everything with :
.
#!/usr/bin/env python
import sys
result = eval(sys.stdin.read())
print expression, "=>", result, type(result)
.
Solution 2:
If you wish to see the result of entire .py
file, you can put this code in your new created external tool window
#!/usr/bin/env python
import sys
exec(sys.stdin.read())
and change the Input
to Current document
.
Solution 3:
For python, You can use "external tools plugin":
#!/bin/sh
python3 "$GEDIT_CURRENT_DOCUMENT_PATH"
Option of external tool: Save: Current Document Input: Current Document Output: Display in bottom panel
Language: Python or Python3
Don't forget the quotes around $GEDIT_CURRENT_DOCUMENT_PATH....
Solution 4:
To answer your second question, and hopefully guide you in a direction you'll be happier with, I think you ought to consider trying some different editors. There are many with more powerful code exploration features than GEdit has. Check out this post:
Solution 5:
I installed iPython console in gedit and do most of my simple scripting in it, but gedit is a very simple editor, so it'll not have some advance feature like an IDE
But if you want code exploring, or auto completion, I recommend a real IDE like Eclipse.
If you just want a editor, KomodoEdit is fine.
Post a Comment for "GEdit/Python Execution Plugin?"