Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #77456

Re: Editing text with an external editor in Python

Path csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!news.stack.nl!newsfeed.xs4all.nl!newsfeed2a.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail
Return-Path <rosuav@gmail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.001
X-Spam-Evidence '*H*': 1.00; '*S*': 0.00; 'root': 0.05; 'subject:text': 0.05; 'subject:Python': 0.06; 'tkinter': 0.07; 'cursor': 0.09; 'editor.': 0.09; 'expected.': 0.09; 'subject:editor': 0.09; 'windows,': 0.09; 'cc:addr:python-list': 0.11; 'wrote': 0.14; "(i'm": 0.16; 'backspace': 0.16; 'entry.': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'reedy': 0.16; 'selects': 0.16; 'tab': 0.16; 'wrote:': 0.18; 'wed,': 0.18; 'bit': 0.19; 'meant': 0.20; 'work,': 0.20; 'select': 0.22; 'import': 0.22; 'cc:addr:python.org': 0.22; 'text.': 0.24; "world's": 0.24; 'cc:2**0': 0.24; 'least': 0.26; 'header:In-Reply- To:1': 0.27; 'rest': 0.29; 'am,': 0.29; "doesn't": 0.30; 'message- id:@mail.gmail.com': 0.30; 'embed': 0.31; 'keys': 0.31; 'sep': 0.31; 'file': 0.32; 'run': 0.32; 'text': 0.33; 'beginning': 0.33; 'minimal': 0.33; 'subject:with': 0.35; 'something': 0.35; 'editor': 0.35; 'test': 0.35; 'but': 0.35; 'received:google.com': 0.35; 'entry': 0.36; 'does': 0.39; 'extremely': 0.39; 'functional': 0.39; 'delete': 0.39; 'sure': 0.39; 'field': 0.63; 'more': 0.64; 'movement': 0.65; 'between': 0.67; 'importantly,': 0.68; 'home': 0.69; 'saving': 0.69; 'cut': 0.74; 'delete,': 0.84; 'to:none': 0.92
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:cc :content-type; bh=sV2k5F2PcR8APiTeHg4F42LSI5dChDSlgcLAwvQbTwg=; b=CojdS7kwalzjQlYUvVSTwq1b8e/DoNgphBb3Fd6WnuUdbkzEOy08CDmGwN9KPDPV7e txOiazbcyvTffRIcWVElUOZjuO2UjUqqjuvtfxoF1FSgPGXvrzGHcWy6OtdSPs3vmdvU Xl25DQzRQ6Uc7BJvQs+IIbrYhptK1ZF6gHJsGH6YkhfUg8/JwmX2rkfzldgiOfB0yAQp SSKgFaO8RE3D1boPYUVD5Baa1pAjmG5lpHiD5r4a+VWnCYBA7VOCBFcOxerUsHoAEMDM D9omsUetMcfuPmmuf9suAdKrk419CQMIejiUEtQtlQDEf0SZRTQVyoUMqJLxNbFN/CEw +o6g==
MIME-Version 1.0
X-Received by 10.42.136.129 with SMTP id u1mr4785455ict.65.1409693781765; Tue, 02 Sep 2014 14:36:21 -0700 (PDT)
In-Reply-To <lu5bvo$q9$1@ger.gmane.org>
References <54049ab7$0$29972$c3e8da3$5496439d@news.astraweb.com> <mailman.13692.1409589319.18130.python-list@python.org> <5404b987$0$30001$c3e8da3$5496439d@news.astraweb.com> <mailman.13694.1409602073.18130.python-list@python.org> <zjfNv.198388$rQ.139558@fx13.am4> <CAPTjJmpPjBmtgC2dvuYmGQNc900rb=XUt5LRGHwS0--G+_xCew@mail.gmail.com> <lu5bvo$q9$1@ger.gmane.org>
Date Wed, 3 Sep 2014 07:36:21 +1000
Subject Re: Editing text with an external editor in Python
From Chris Angelico <rosuav@gmail.com>
Cc "python-list@python.org" <python-list@python.org>
Content-Type text/plain; charset=UTF-8
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.15
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <https://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.13720.1409693783.18130.python-list@python.org> (permalink)
Lines 36
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1409693783 news.xs4all.nl 2847 [2001:888:2000:d::a6]:39263
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:77456

Show key headers only | View raw


On Wed, Sep 3, 2014 at 7:14 AM, Terry Reedy <tjreedy@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
else!

ChrisA

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Editing text with an external editor in Python Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2014-09-02 02:11 +1000
  Re: Editing text with an external editor in Python Chris Angelico <rosuav@gmail.com> - 2014-09-02 02:35 +1000
    Re: Editing text with an external editor in Python Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2014-09-02 04:23 +1000
      Re: Editing text with an external editor in Python Tim Chase <python.list@tim.thechases.com> - 2014-09-01 15:06 -0500
        Re: Editing text with an external editor in Python alister <alister.nospam.ware@ntlworld.com> - 2014-09-02 08:35 +0000
          Re: Editing text with an external editor in Python Chris Angelico <rosuav@gmail.com> - 2014-09-02 18:45 +1000
            Re: Editing text with an external editor in Python alister <alister.nospam.ware@ntlworld.com> - 2014-09-03 08:06 +0000
          Re: Editing text with an external editor in Python Terry Reedy <tjreedy@udel.edu> - 2014-09-02 17:14 -0400
          Re: Editing text with an external editor in Python Chris Angelico <rosuav@gmail.com> - 2014-09-03 07:36 +1000
          Re: Editing text with an external editor in Python Terry Reedy <tjreedy@udel.edu> - 2014-09-02 21:49 -0400
          Re: Editing text with an external editor in Python Zachary Ware <zachary.ware+pylist@gmail.com> - 2014-09-02 22:03 -0500
      Re: Editing text with an external editor in Python Chris Angelico <rosuav@gmail.com> - 2014-09-02 08:30 +1000
  Re: Editing text with an external editor in Python Roy Smith <roy@panix.com> - 2014-09-01 13:06 -0400
    Re: Editing text with an external editor in Python Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2014-09-02 04:02 +1000
      Re: Editing text with an external editor in Python Cameron Simpson <cs@zip.com.au> - 2014-09-02 08:14 +1000
        Re: Editing text with an external editor in Python Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2014-09-02 13:18 +1000
      Re: Editing text with an external editor in Python Chris Angelico <rosuav@gmail.com> - 2014-09-02 08:25 +1000
  Re: Editing text with an external editor in Python gschemenauer3@gmail.com - 2014-09-01 19:24 -0700

csiph-web