Simple Python + Tk text editor
Jonathan Fine
jfine at pytex.org
Thu Apr 14 01:41:26 EDT 2005
Paul Rubin wrote:
> Jonathan Fine <jfine at pytex.org> writes:
>
>>I'm looking for a simple Python + Tk text editor.
>>
>>I want it as a building block/starting point.
>
>
> Something wrong with IDLE?
Thanks for this suggestion.
For some reason, I did not think of IDLE as an editor.
Must have been a blind spot.
Though not simple, IDLE is a good starting point for me.
And for my project (integration of Python and TeX) there
is most unlikely to be a better one.
However, learning IDLE details might be quite a detour
from my immediate goals.
Some code follows, in case anyone else is interested.
IDLE is not yet a package, it seems. But the idea is there.
===
jfine at apricot:/usr/lib/idle-python2.1$ cat __init__.py
# Dummy file to make this a potential package.
===
/usr/bin/idle hacked to produce an EditorWindow.
===
#! /usr/bin/python
import os
import sys
sys.path[:0] = ['/usr/lib/idle-python2.1']
import IdleConf
idle_dir = os.path.dirname(IdleConf.__file__)
IdleConf.load(idle_dir)
# new code
import Tkinter
import EditorWindow
root = Tkinter.Tk()
EditorWindow.EditorWindow(root=root)
EditorWindow.mainloop()
sys.exit()
# end of new code
# defer importing Pyshell until IdleConf is loaded
import PyShell
PyShell.main()
===
--
Jonathan
http://qatex.souceforge.org
More information about the Python-list
mailing list