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


Groups > comp.lang.python > #63137

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!newsfeed3.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.023
X-Spam-Evidence '*H*': 0.95; '*S*': 0.00; 'works.': 0.09; '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; 'module': 0.19; '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; 'idea': 0.28; 'chris': 0.29; 'skip:p 30': 0.29; 'am,': 0.29; 'mode': 0.30; 'message-id:@mail.gmail.com': 0.30; 'too.': 0.31; '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; 'thanks': 0.36; 'subject:?': 0.36; 'should': 0.36; 'thank': 0.38; 'pm,': 0.38; 'how': 0.40; '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=QO03sNZ9YvhZ7IEzEKnB9rDOgM8vtVfexRRjQz30DMQ=; b=WRgFAICDQLkfsF/3aG8rt4X9qr9yP1Q+zpuJ/iJHIdCrgn5br5wgNy8llLCUvnXgzV k6LThAzZtv0cE/OwBXpwBraoTr+gcakT2BRykX1m7OVeLhu2UQi8gr9lYNnVdODBCpOz eLNCFyPI1bBO4MXXs9Ln4cX1acXM74Gxn0LNwQhEJak/CrLug6nfj6HPpADC4ysR60dR Sq88l4VENaR0JR8RHYkzC2X3RweF22N1W5ZDrsAjcz7GYLhICYdswB8STQhaEGBccKvi BoBy+AYGGEEsAGgZ/jzyu2uX31cmXQvdfK5iE0u632faCVsaUk9Gvhh3RnDNSYNgdUOt oQ+g==
MIME-Version 1.0
X-Received by 10.221.33.206 with SMTP id sp14mr2614608vcb.29.1388853066809; Sat, 04 Jan 2014 08:31:06 -0800 (PST)
In-Reply-To <CAPbpa4Si0wyFyWVegOhf6+h3Tk6=h3QH1swkujkCOjJTJXiPPQ@mail.gmail.com>
References <CAPbpa4R0HBbztNKjj9e+S4ATCtMU8bAreopjxUUqOLDrtvH_oA@mail.gmail.com> <CADwdpyYGmfV7wbEpWj0YXMZ=8kSep4EPQ6H181ungJwoF=0Vgg@mail.gmail.com> <CAPbpa4Si0wyFyWVegOhf6+h3Tk6=h3QH1swkujkCOjJTJXiPPQ@mail.gmail.com>
Date Sat, 4 Jan 2014 11:31:06 -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=001a11365136b1470804ef278ddf
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.4907.1388853075.18130.python-list@python.org> (permalink)
Lines 106
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1388853075 news.xs4all.nl 2897 [2001:888:2000:d::a6]:57238
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:63137

Show key headers only | View raw


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

... and thanks to Chris too.
Now I got the better idea how the subprocess module works.


On Sat, Jan 4, 2014 at 11:29 AM, Beinan Li <li.beinan@gmail.com> wrote:

> 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:31 -0500

csiph-web