continuous plotting with Tkinter
Russell E. Owen
no at spam.invalid
Thu Feb 3 15:25:48 EST 2005
In article <42010f48$0$3408$5402220f at news.sunrise.ch>,
"Martin Blume" <mblume at socha.net> wrote:
>I have a number-crunching application that spits out
>a lot of numbers. Now I'd like to pipe this into a python
>app and plot them using Tkinter, such as:
>$ number_cruncher | myplot.py
>But with Tkinter once I call Tkinter's mainloop() I
>give up my control of the app and I can't continue to
>read in data from stdin. Or can I? If so, how?
One way is to use a thread to read the numbers, then make them available
to the main thread via a Queue object, which you poll for new values.
Another option is to use a Tk-compatible file or socket of some kind
which triggers a callback when data comes in. See
<http://www.astro.washington.edu/rowen/TkinterSummary.html#FileHandlers>
some ideas on this.
-- Russell
More information about the Python-list
mailing list