Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #104133
| Path | csiph.com!news.swapon.de!fu-berlin.de!uni-berlin.de!not-for-mail |
|---|---|
| From | Terry Reedy <tjreedy@udel.edu> |
| Newsgroups | comp.lang.python |
| Subject | Re: Application console for Tkinter program? |
| Date | Sun, 6 Mar 2016 07:12:43 -0500 |
| Lines | 37 |
| Message-ID | <mailman.239.1457266393.20602.python-list@python.org> (permalink) |
| References | <nbe31k$c9$1@dont-email.me> <mailman.221.1457172954.20602.python-list@python.org> <nbegmb$b0q$1@dont-email.me> <mailman.232.1457212605.20602.python-list@python.org> <nbgsoa$upt$1@dont-email.me> |
| Mime-Version | 1.0 |
| Content-Type | text/plain; charset=utf-8; format=flowed |
| Content-Transfer-Encoding | 7bit |
| X-Trace | news.uni-berlin.de 2jafutqEil0Quucf3eDpFQ5TI1MRulgyR/hwIl7ZbadA== |
| Return-Path | <python-python-list@m.gmane.org> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.000 |
| X-Spam-Evidence | '*H*': 1.00; '*S*': 0.00; 'python,': 0.02; 'expressions': 0.07; 'instance.': 0.09; 'mode,': 0.09; 'prefixed': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'repl': 0.09; 'statements': 0.09; 'subclass': 0.09; 'subclasses': 0.09; 'toplevel': 0.09; 'python': 0.10; 'assume': 0.11; 'jan': 0.11; 'syntax': 0.13; 'result.': 0.15; 'compile,': 0.16; 'eval': 0.16; 'idle,': 0.16; 'idlelib': 0.16; 'interacting': 0.16; 'out?': 0.16; 'received:80.91.229.3': 0.16; 'received:io': 0.16; 'received:plane.gmane.org': 0.16; 'received:psf.io': 0.16; 'reedy': 0.16; 'subject:Tkinter': 0.16; 'subject:program': 0.16; 'subprocess': 0.16; 'useless': 0.16; 'wrote:': 0.16; 'later': 0.16; 'example.': 0.18; 'widget': 0.18; 'shell': 0.18; 'runs': 0.18; 'assign': 0.22; 'exec': 0.22; 'parse': 0.22; 'am,': 0.23; 'code,': 0.23; 'code.': 0.23; '(or': 0.23; "haven't": 0.24; 'header:In-Reply-To:1': 0.24; 'header:User-Agent:1': 0.26; "doesn't": 0.26; 'header:X-Complaints-To:1': 0.26; 'entered': 0.27; 'least': 0.27; 'actual': 0.28; 'lot.': 0.29; 'mode.': 0.29; 'print': 0.30; 'code': 0.30; 'class.': 0.30; 'run': 0.33; 'class': 0.33; 'source': 0.33; 'idle': 0.33; 'traditional': 0.33; "i'll": 0.33; 'thanks!': 0.34; 'could': 0.35; 'text': 0.35; 'instance': 0.35; 'but': 0.36; 'too': 0.36; 'should': 0.36; 'instead': 0.36; '(and': 0.36; 'modules': 0.36; 'to:addr:python-list': 0.36; 'subject:?': 0.36; 'subject:: ': 0.37; 'display': 0.37; 'received:org': 0.37; 'difference': 0.38; 'christian': 0.38; 'skip:p 20': 0.38; 'does': 0.39; 'application': 0.39; 'to:addr:python.org': 0.40; 'still': 0.40; 'details': 0.62; 'received:96': 0.63; 'complete': 0.63; 'between': 0.65; 'believe': 0.66; 'state.': 0.72; 'gollwitzer': 0.84; 'received:fios.verizon.net': 0.91; 'browse': 0.96 |
| X-Injected-Via-Gmane | http://gmane.org/ |
| X-Gmane-NNTP-Posting-Host | pool-96-227-207-81.phlapa.fios.verizon.net |
| User-Agent | Mozilla/5.0 (Windows NT 10.0; WOW64; rv:38.0) Gecko/20100101 Thunderbird/38.6.0 |
| In-Reply-To | <nbgsoa$upt$1@dont-email.me> |
| X-BeenThere | python-list@python.org |
| X-Mailman-Version | 2.1.21 |
| 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> |
| Xref | csiph.com comp.lang.python:104133 |
Show key headers only | View raw
On 3/6/2016 4:23 AM, Christian Gollwitzer wrote: > Am 05.03.16 um 22:16 schrieb Terry Reedy: >> Not now. A console is a REPL + text display to read from and print to. >> The actual IDLE REPL is PyShell.ModifiedInterpreter, which subclasses >> stdlib code.InteractiveInterpreter. Most of the additions are for >> interacting with the subprocess that runs user code. You should start >> instead with the base class. >> >> The Shell text display is a subclass of a subclass of a class that >> contains a subclass of Toplevel with the complete IDLE Menu and a Text >> widget wrapper. Again, this is too much baggage for an application >> console. >> >> The idlelib ColorDelegator syntax highlighter can be reused with a Text >> instance. See turtledemo.__main__ for an example. I don't know if (or >> how) IDLE's autocompletion modules could be reused in their current >> state. I believe Shell's history 'list' consists of the statements in >> the Text instance prefixed by the '>>> ' prompt. > > Thanks! I'll try to browse my way through the source code, these details > help a lot. I still haven't understood the difference between exec() and > eval(). I understand that for statements you want to exec them, for > expressions you eval it and print the result. When the user has entered > code, how does the REPL know if it should be eval'ed or exec'ed? I > assume that you don't try to parse the Python code manually to find this > out? Or you try to eval(), and if it doesn't compile, you exec()? Python expressions are also statements. Python REPLs exec statements. But to make Read-Exec-Print work like traditional Read-Eval-Print, Python, in interactive mode, echos the value of expression statements (and assign it to _ for later reuse). So '2 + 2' echos 4 in REPL, or at least in the console and IDLE, '2 + 2' is useless in a program run in batch mode. -- Terry Jan Reedy
Back to comp.lang.python | Previous | Next — Previous in thread | Find similar | Unroll thread
Application console for Tkinter program? Christian Gollwitzer <auriocus@gmx.de> - 2016-03-05 08:52 +0100
Re: Application console for Tkinter program? Terry Reedy <tjreedy@udel.edu> - 2016-03-05 05:15 -0500
Re: Application console for Tkinter program? Christian Gollwitzer <auriocus@gmx.de> - 2016-03-05 12:45 +0100
Re: Application console for Tkinter program? Terry Reedy <tjreedy@udel.edu> - 2016-03-05 16:16 -0500
Re: Application console for Tkinter program? Christian Gollwitzer <auriocus@gmx.de> - 2016-03-06 10:23 +0100
Re: Application console for Tkinter program? Terry Reedy <tjreedy@udel.edu> - 2016-03-06 07:12 -0500
csiph-web