<br><br><div class="gmail_quote">On Mon, Aug 16, 2010 at 5:13 AM, 金鑫鑫 <span dir="ltr"><<a href="mailto:jemygraw@gmail.com">jemygraw@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
Hi Man,<div>I have done that according to your requirements</div><div>Here is the code </div><div>{code}</div><blockquote class="gmail_quote" style="margin-top:0px;margin-right:0px;margin-bottom:0px;margin-left:0.8ex;border-left-width:1px;border-left-color:rgb(204, 204, 204);border-left-style:solid;padding-left:1ex">

<blockquote class="gmail_quote" style="margin-top:0px;margin-right:0px;margin-bottom:0px;margin-left:0.8ex;border-left-width:1px;border-left-color:rgb(204, 204, 204);border-left-style:solid;padding-left:1ex">
#!/usr/bin/python</blockquote><blockquote class="gmail_quote" style="margin-top:0px;margin-right:0px;margin-bottom:0px;margin-left:0.8ex;border-left-width:1px;border-left-color:rgb(204, 204, 204);border-left-style:solid;padding-left:1ex">

import Tkinter</blockquote><blockquote class="gmail_quote" style="margin-top:0px;margin-right:0px;margin-bottom:0px;margin-left:0.8ex;border-left-width:1px;border-left-color:rgb(204, 204, 204);border-left-style:solid;padding-left:1ex">

import threading</blockquote><blockquote class="gmail_quote" style="margin-top:0px;margin-right:0px;margin-bottom:0px;margin-left:0.8ex;border-left-width:1px;border-left-color:rgb(204, 204, 204);border-left-style:solid;padding-left:1ex">

<br></blockquote><blockquote class="gmail_quote" style="margin-top:0px;margin-right:0px;margin-bottom:0px;margin-left:0.8ex;border-left-width:1px;border-left-color:rgb(204, 204, 204);border-left-style:solid;padding-left:1ex">

root=Tkinter.Tk()</blockquote><blockquote class="gmail_quote" style="margin-top:0px;margin-right:0px;margin-bottom:0px;margin-left:0.8ex;border-left-width:1px;border-left-color:rgb(204, 204, 204);border-left-style:solid;padding-left:1ex">

root.geometry("100x100")</blockquote><blockquote class="gmail_quote" style="margin-top:0px;margin-right:0px;margin-bottom:0px;margin-left:0.8ex;border-left-width:1px;border-left-color:rgb(204, 204, 204);border-left-style:solid;padding-left:1ex">

v=Tkinter.StringVar()<span style="white-space:pre-wrap">        </span></blockquote><blockquote class="gmail_quote" style="margin-top:0px;margin-right:0px;margin-bottom:0px;margin-left:0.8ex;border-left-width:1px;border-left-color:rgb(204, 204, 204);border-left-style:solid;padding-left:1ex">

label=Tkinter.Label(root,textvariable=v,fg="red")</blockquote><blockquote class="gmail_quote" style="margin-top:0px;margin-right:0px;margin-bottom:0px;margin-left:0.8ex;border-left-width:1px;border-left-color:rgb(204, 204, 204);border-left-style:solid;padding-left:1ex">

label.pack(fill=Tkinter.X,expand=1)</blockquote><blockquote class="gmail_quote" style="margin-top:0px;margin-right:0px;margin-bottom:0px;margin-left:0.8ex;border-left-width:1px;border-left-color:rgb(204, 204, 204);border-left-style:solid;padding-left:1ex">

<br></blockquote><blockquote class="gmail_quote" style="margin-top:0px;margin-right:0px;margin-bottom:0px;margin-left:0.8ex;border-left-width:1px;border-left-color:rgb(204, 204, 204);border-left-style:solid;padding-left:1ex">

<br></blockquote><blockquote class="gmail_quote" style="margin-top:0px;margin-right:0px;margin-bottom:0px;margin-left:0.8ex;border-left-width:1px;border-left-color:rgb(204, 204, 204);border-left-style:solid;padding-left:1ex">

def getInput():</blockquote><blockquote class="gmail_quote" style="margin-top:0px;margin-right:0px;margin-bottom:0px;margin-left:0.8ex;border-left-width:1px;border-left-color:rgb(204, 204, 204);border-left-style:solid;padding-left:1ex">

<span style="white-space:pre-wrap">     </span>while True:</blockquote><blockquote class="gmail_quote" style="margin-top:0px;margin-right:0px;margin-bottom:0px;margin-left:0.8ex;border-left-width:1px;border-left-color:rgb(204, 204, 204);border-left-style:solid;padding-left:1ex">

<span style="white-space:pre-wrap">             </span>global v</blockquote><blockquote class="gmail_quote" style="margin-top:0px;margin-right:0px;margin-bottom:0px;margin-left:0.8ex;border-left-width:1px;border-left-color:rgb(204, 204, 204);border-left-style:solid;padding-left:1ex">

<span style="white-space:pre-wrap">             </span>inputStr=raw_input("Enter>>")</blockquote><blockquote class="gmail_quote" style="margin-top:0px;margin-right:0px;margin-bottom:0px;margin-left:0.8ex;border-left-width:1px;border-left-color:rgb(204, 204, 204);border-left-style:solid;padding-left:1ex">

<span style="white-space:pre-wrap">             </span>v.set(inputStr)</blockquote><blockquote class="gmail_quote" style="margin-top:0px;margin-right:0px;margin-bottom:0px;margin-left:0.8ex;border-left-width:1px;border-left-color:rgb(204, 204, 204);border-left-style:solid;padding-left:1ex">

t1=threading.Thread(target=getInput,args=())</blockquote><blockquote class="gmail_quote" style="margin-top:0px;margin-right:0px;margin-bottom:0px;margin-left:0.8ex;border-left-width:1px;border-left-color:rgb(204, 204, 204);border-left-style:solid;padding-left:1ex">

t1.start()</blockquote><blockquote class="gmail_quote" style="margin-top:0px;margin-right:0px;margin-bottom:0px;margin-left:0.8ex;border-left-width:1px;border-left-color:rgb(204, 204, 204);border-left-style:solid;padding-left:1ex">

<br></blockquote><blockquote class="gmail_quote" style="margin-top:0px;margin-right:0px;margin-bottom:0px;margin-left:0.8ex;border-left-width:1px;border-left-color:rgb(204, 204, 204);border-left-style:solid;padding-left:1ex">

Tkinter.mainloop()</blockquote><div><br></div></blockquote><div>{code}<br><br><div class="gmail_quote">2010/8/16 ChrisChia <span dir="ltr"><<a href="mailto:chrischia82@gmail.com" target="_blank">chrischia82@gmail.com</a>></span><div>
<div></div><div class="h5"><br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">On Aug 16, 4:17 am, Terry Reedy <<a href="mailto:tjre...@udel.edu" target="_blank">tjre...@udel.edu</a>> wrote:<br>

> On 8/15/2010 10:22 AM, ChrisChia wrote:<br>
><br>
> > Hi all,<br>
> > i am trying to do a GUI with Tkinter package, but i am stuck no matter<br>
> > what...<br>
> > The problem right now is that my GUI has a label= 'A' (where 'A' is<br>
> > the text on display)<br>
><br>
> > i wish to run a program with 2 threads... one for my GUI and the other<br>
> > for the terminal where the terminal will keep listening to the user<br>
> > input (let's say if he enters 'B'), the GUI will update it's label to<br>
> > 'B'.<br>
><br>
> Makes no sense to me. GUI = graphics user interface. Interface = input<br>
> from and output to the user. Additional threads for for other activities<br>
> that may block or be compute intensive, not a separate text user interface.<br>
><br>
> > It's easy to let the terminal wait after the user has entered the<br>
> > input.<br>
> > But the problem is that when the GUI loads up... the<br>
><br>
> > root.mainloop()<br>
><br>
> > doesn't seem to release the control,<br>
><br>
> That seems to be the point of a GUI<br>
><br>
> --<br>
> Terry Jan Reedy<br>
<br>
<br>
The idea has is that the interface acts as a window to display the<br>
text type from the terminal.<br>
It's a crazy idea but i wish to implement something that way.<br>
<br>
The GUI in the case will display any text that the user enters from<br>
the terminal...<br>
<br>
Any idea to make both the processes running and listening at the same<br>
time?<br>
<font color="#888888">--<br>
<a href="http://mail.python.org/mailman/listinfo/python-list" target="_blank">http://mail.python.org/mailman/listinfo/python-list</a><br>
</font></blockquote></div></div></div><br></div>
</blockquote></div><br><br clear="all"><br>-- <br>Hi,I am Jemy<br>