Editing text with an external editor in Python

Chris Angelico rosuav at gmail.com
Tue Sep 2 23:36:21 CEST 2014

On Wed, Sep 3, 2014 at 7:14 AM, Terry Reedy <tjreedy at udel.edu> wrote:
> import tkinter as tk
> root = tk.Tk()
> text = tk.Text()
> text.pack()
> root.mainloop()
> I tested tested the functions and wrote the following.
> This is a test text entry.
> Enter and Tab work as expected.
> The Arrow (Cursor) keys work as expected.
> CntL-Left and Cntl-Right move a word at time.
> Home and End move to beginning and end of the line.
> Cntl-Home and Cntl-Up move to the beginning of the text.
> Cntl-End and Cntl-Donw move to the end of the text.
> Shift + cursor movement selects between the begin and end slice positions.
> PageUp and PageDown are inoperative.
> Delete and Backspace work as expected.
> At least on Windows, I can select text and delete,
> or cut or copy to Clipboard.
> I can also paste from the clipboard.
> In otherwords, this is a functional minimal text entry widget.

Err, that's not all it takes to run an editor :) File opening and
saving would be kinda helpful, for a start...

But that's what I meant when I said that a multi-line entry field is
an extremely standard widget. (I'm a bit surprised that PgUp/PgDn
don't work, but the rest of what you say is perfectly standard.) It's
a bit harder to do an editor that doesn't just call on a GUI, and more
importantly, "tk.Text().pack()" does not make the world's best editor.
But it sure is handy when you want to embed an editor in something


More information about the Python-list mailing list