Path: csiph.com!fu-berlin.de!uni-berlin.de!not-for-mail From: Terry Reedy Newsgroups: comp.lang.python Subject: Re: [Ubuntu] PyQt5 Date: Mon, 9 Nov 2015 05:24:43 -0500 Lines: 65 Message-ID: References: <7056c802-308b-4d5c-961d-052ef2671633@googlegroups.com> <201511090241.tA92f7jZ008906@fido.openend.se> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-Trace: news.uni-berlin.de DSUI5hOdvBTaoVm3/aI8CgvWKpaqGik7QQDYe3H8uLvA== Return-Path: 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; 'subject:: [': 0.03; 'cpython': 0.05; 'python3': 0.05; 'tries': 0.05; 'socket': 0.07; 'works.': 0.07; 'creighton': 0.09; 'exiting': 0.09; 'fix.': 0.09; 'input,': 0.09; 'mode,': 0.09; 'namespace': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'warn': 0.09; 'thread': 0.10; 'python': 0.10; 'python.': 0.11; 'jan': 0.11; 'did.': 0.16; 'editor,': 0.16; 'idle.': 0.16; 'invoking': 0.16; 'program),': 0.16; 'qt,': 0.16; 'raises.': 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; 'subprocess': 0.16; 'substitute': 0.16; 'wrote:': 0.16; 'instance,': 0.18; 'laura': 0.18; 'gui': 0.18; 'shell': 0.18; 'tests': 0.18; 'runs': 0.18; 'subject:] ': 0.19; '>>>': 0.20; '2015': 0.20; 'meant': 0.22; 'not,': 0.22; 'assumes': 0.22; 'latter': 0.22; 'tkinter': 0.22; 'trying': 0.22; 'code,': 0.23; 'sets': 0.23; 'tried': 0.24; 'examples': 0.24; 'plain': 0.24; 'somewhere': 0.24; 'header:In-Reply-To:1': 0.24; 'module': 0.25; 'testing': 0.25; 'header:User-Agent:1': 0.26; 'header:X -Complaints-To:1': 0.26; 'separate': 0.27; 'least': 0.27; 'transition': 0.27; 'developing': 0.28; 'fine': 0.28; '-0500,': 0.29; 'starts': 0.29; 'asked': 0.29; 'work.': 0.30; 'code': 0.30; 'normally': 0.30; "i'd": 0.31; 'option': 0.31; 'run': 0.33; 'problem': 0.33; 'url:python': 0.33; 'doubt': 0.33; 'idle': 0.33; 'limitations': 0.33; 'stream': 0.33; 'running': 0.34; 'add': 0.34; 'gets': 0.35; 'could': 0.35; 'execution': 0.35; 'interact': 0.35; 'nov': 0.35; 'but': 0.36; 'too': 0.36; 'instead': 0.36; 'there': 0.36; 'url:org': 0.36; 'mode': 0.36; 'modules': 0.36; 'url:library': 0.36; 'to:addr:python-list': 0.36; 'pm,': 0.36; 'received:org': 0.37; 'thought': 0.37; 'things': 0.38; 'mean': 0.38; 'why': 0.39; 'test': 0.39; 'does': 0.39; 'skip:e 20': 0.39; 'to:addr:python.org': 0.40; 'some': 0.40; 'questions': 0.40; 'url:3': 0.60; 'entire': 0.61; 'programs': 0.62; 'here.': 0.62; 'different': 0.63; 'within': 0.64; 'deeply': 0.64; 'other.': 0.64; 'believe': 0.66; 'differences': 0.66; 'packages,': 0.66; 'here': 0.66; 'below.': 0.66; 'restore': 0.70; 'advantages': 0.72; 'programs,': 0.72; 'locals': 0.84; 'messed': 0.84; 'thereof': 0.84; 'tkinter,': 0.84; 'received:fios.verizon.net': 0.91; 'simulation': 0.91; 'imagine': 0.96 X-Injected-Via-Gmane: http://gmane.org/ X-Gmane-NNTP-Posting-Host: pool-173-59-124-74.phlapa.fios.verizon.net User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:38.0) Gecko/20100101 Thunderbird/38.3.0 In-Reply-To: <201511090241.tA92f7jZ008906@fido.openend.se> X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.20+ Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Xref: csiph.com comp.lang.python:98508 On 11/8/2015 9:41 PM, Laura Creighton wrote: > In a message of Sun, 08 Nov 2015 18:05:32 -0500, Terry Reedy writes: >>> I just read somewhere that the issue could be because I was trying to >>> run these examples from within Idle. First let me note that a) IDLE is meant for learning Python and developing Python programs, and b) IDLE using tkinter/tcl/tk and programs that introspect too deeply or interact with hardware can interfere with each other. I recently added https://docs.python.org/3/library/idle.html#idle-console-differences to document some differences from console python. Can IDLE be used for developing GUI programs? In the case of tkinter, yes. For 3.x, at least, I believe there are advantages over plain editors. For other gui packages, I would like to know what limitations or problems there are so I can warn people against trying to do things that will not work. Hence the questions below. >> I am an IDLE maintainer. Am I to take it that everything ran fine >> before you tried to quit? If not, I would want to know why and try to fix. >> >> If you run tut.py from an IDLE editor, IDLE tries to run it the same as >> if you ran it at a console in the tut.py directory with 'python3 -i >> tut.py'. I can imagine that there might be a problem with the >> transition from gui mode to interactive shell mode, though it works for >> tkinter apps. You said 'python3 tut.py' works. What happens if you add >> the '-i' option? I'd like to know if the transition problem is in >> (Py)qt5 or in IDLE's simulation of '-i'. > I suspect that Qt and Idle are disagreeing as to who gets to have the > main thread around here. I doubt this is the specific problem because user code, here invoking pyqt and qt, are run in a separate process. While it is running, I believe the only Idle code that would run is in the substitute stdin/out/err, which are only used if the user code calls input, print, or .write() or raises. Instead of > python3 -i mypyqt.py at a console prompt, IDLE starts a subprocess with > python -m idlelib.run mypyqt.py The latter sets up socket communication, a locals namespace that imitates __main__, and a few other things and then runs exec(open(mypyqt.py).read(), locals). I can imagine a few different ways things could get messed up, which is why I asked the specific questions I did. For instance, if a program rebinds the standard stream but does not restore them, because it assumes that exiting the program mean exiting the process (as would normally be the case with a gui program), then the '-i' option and the IDLE simulation thereof may not work. In thinking about this, I realized that I could test that idlelib.run at least works with all stdlib modules by running the entire CPython test suite in the execution process. I already run idle tests in IDLE while developing them, but had never thought about the fact that I was testing the run module also. -- Terry Jan Reedy