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


Groups > comp.lang.python > #63136

Re: How to make a tkinter GUI work on top of a CUI program?

Path csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!newsfeed.xs4all.nl!newsfeed2.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail
Return-Path <li.beinan@gmail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.035
X-Spam-Evidence '*H*': 0.93; '*S*': 0.00; 'subject:How': 0.10; 'cc:addr:python-list': 0.11; 'def': 0.12; 'jan': 0.12; 'attributes,': 0.16; 'carefully.': 0.16; 'event):': 0.16; 'mode,': 0.16; 'read()': 0.16; 'stdout': 0.16; 'subject:GUI': 0.16; 'subject:make': 0.16; 'subject:program': 0.16; 'subject:top': 0.16; 'sat,': 0.16; 'wrote:': 0.18; 'command': 0.22; 'email addr:gmail.com&gt;': 0.22; 'shell': 0.22; 'cc:addr:python.org': 0.22; 'looks': 0.24; 'cc:2**0': 0.24; '&gt;': 0.26; 'right.': 0.26; 'tutorials': 0.26; 'header:In-Reply-To:1': 0.27; 'skip:p 30': 0.29; 'am,': 0.29; 'mode': 0.30; 'message- id:@mail.gmail.com': 0.30; 'end,': 0.31; 'pipe': 0.31; 'probably': 0.32; 'fri,': 0.33; 'something': 0.35; 'but': 0.35; 'received:google.com': 0.35; 'add': 0.35; 'subject:?': 0.36; 'should': 0.36; 'thank': 0.38; 'pm,': 0.38; 'read': 0.60; 'mentioned': 0.61; "you're": 0.61; 'first': 0.61; "you'll": 0.62; 'such': 0.63; 'more': 0.64; 'to:addr:gmail.com': 0.65; 'header :Reply-To:1': 0.67; 'results': 0.69; 'online': 0.71; 'reply-to:no real name:2**0': 0.71; 'reply-to:addr:gmail.com': 0.80; 'write()': 0.91; 'hill': 0.95
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:reply-to:in-reply-to:references:date:message-id :subject:from:to:cc:content-type; bh=vJAm9l3BCIl/d+pJiwc9EaexVbE6Uuxf57gosMN3j6w=; b=Wf4c/xnV05pCXWUYhMNTFTGkl/8d3NKWAgd5JylE4RkEPCdd+YWk04wdG0CtP9YZvy ZwvCsZpN3crQ1VwM3jo06jMZZb5cBxItn7VaW9OhjxWTZU0RCopIx5Tcd7Hhu3JTPuM+ r5/skZVhnfk3DtV+wJKC7VBoq3h/t8Zq89rke8Ghs+TEyLZXM7xz939KfgEsW6xkINWo JMIPG1YI7mIgxR/xBj6zsd8QRiHZxzAemJE6ne75+shw7AsQBavT9hmV14wVvIgonC0E eoei9B8evkpsCi0KNsO6Utlwh6bAf1ZUOwa7Vkh9mo5JPpMTNlCVgPzBjlTfAaC29Wpv dGww==
MIME-Version 1.0
X-Received by 10.220.169.146 with SMTP id z18mr95904vcy.58.1388852967656; Sat, 04 Jan 2014 08:29:27 -0800 (PST)
In-Reply-To <CADwdpyYGmfV7wbEpWj0YXMZ=8kSep4EPQ6H181ungJwoF=0Vgg@mail.gmail.com>
References <CAPbpa4R0HBbztNKjj9e+S4ATCtMU8bAreopjxUUqOLDrtvH_oA@mail.gmail.com> <CADwdpyYGmfV7wbEpWj0YXMZ=8kSep4EPQ6H181ungJwoF=0Vgg@mail.gmail.com>
Date Sat, 4 Jan 2014 11:29:27 -0500
Subject Re: How to make a tkinter GUI work on top of a CUI program?
From Beinan Li <li.beinan@gmail.com>
To Jerry Hill <malaclypse2@gmail.com>
Content-Type multipart/alternative; boundary=001a11c28b54c850f904ef278796
Cc "python-list \(General\)" <python-list@python.org>
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.15
Precedence list
Reply-To li.beinan@gmail.com
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.4906.1388852975.18130.python-list@python.org> (permalink)
Lines 89
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1388852975 news.xs4all.nl 2903 [2001:888:2000:d::a6]:54397
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:63136

Show key headers only | View raw


[Multipart message — attachments visible in raw view] - view raw

Thank you so much Jerry.
I should have read though the man page more carefully.
The available online cscope tutorials never mentioned the line-oriented
mode.



On Sat, Jan 4, 2014 at 1:35 AM, Jerry Hill <malaclypse2@gmail.com> wrote:

> On Fri, Jan 3, 2014 at 9:44 PM, Beinan Li <li.beinan@gmail.com> wrote:
> > But some console programs have their own shell or ncurse-like CUI, such
> as
> > cscope.
> > So I figured that I need to first subprocess.popen a bidirectional pipe
> and
> > send command through stdin and get results from stdout and stderr.
> >
> > But in such a case I found that communicate('cmd') will freeze.
>
> Right.  communicate() waits for the subprocess to end, and the
> subprocess is still waiting for you to do something.  Instead, you'll
> need to read() and write() to the subprocess' stdin and stdout
> attributes, probably something like this (untested):
>
> def OnClickBtn(self, event):
>     print('OnClickBtn')
>     self.subProc.stdin.write('symbolName\n')
>     print(self.subProc.stdout.read())
>
> It looks like cscope has both a screen-oriented mode and a line-based
> mode.  When you're working with a subprocess like this, you're going
> to want to be in the line-based mode, so you'll probably want to add
> -l or -L to your command line.
>
> --
> Jerry
>

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


Thread

Re: How to make a tkinter GUI work on top of a CUI program? Beinan Li <li.beinan@gmail.com> - 2014-01-04 11:29 -0500

csiph-web