niXforums Forum Index
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   PreferencesPreferences   Log in to check your private messagesLog in to check your private messages   Log inLog in 
·  nixdoc.net ·  man pages ·  Linux HOWTOs ·  FreeBSD Tips ·  Forums
navigation Forum index » Programming » python
continuous plotting with Tkinter
Post new topic   Reply to topic Page 1 of 1 [4 Posts] View previous topic :: View next topic
Author Message
Martin Blume
*nix forums addict


Joined: 20 Feb 2005
Posts: 53

PostPosted: Fri Feb 04, 2005 9:32 am    Post subject: Re: continuous plotting with Tkinter Reply with quote

"Russell E. Owen" schrieb
Quote:

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.

I already tinkered with threads, yet it didn't work.

I'll try again.

Quote:

Another option is to use a Tk-compatible file or socket
of some kind which triggers a callback when data comes
in. See

htttp://www.astro.washington.edu/rowen/TkinterSummary.html#FileHand
lers


Quote:
some ideas on this.

Thanks, I'll look.


Martin
Back to top
Russell E. Owen
*nix forums Guru Wannabe


Joined: 28 Feb 2005
Posts: 117

PostPosted: Thu Feb 03, 2005 7:25 pm    Post subject: Re: continuous plotting with Tkinter Reply with quote

In article <42010f48$0$3408$5402220f@news.sunrise.ch>,
"Martin Blume" <mblume@socha.net> wrote:

Quote:
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
Back to top
David Douard
*nix forums beginner


Joined: 02 Feb 2005
Posts: 3

PostPosted: Wed Feb 02, 2005 10:40 pm    Post subject: Re: continuous plotting with Tkinter Reply with quote

Martin Blume wrote:

Quote:
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?

Regards
Martin

Maybe the simpler is to run the Tk mainloop in a separate thread.
You may have a look a candygram which gives a very simple to use
multi-thread semantics (ala Haskell) and is simpler to use than the
threading module.
Back to top
Martin Blume
*nix forums addict


Joined: 20 Feb 2005
Posts: 53

PostPosted: Wed Feb 02, 2005 4:35 pm    Post subject: continuous plotting with Tkinter Reply with quote

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?

Regards
Martin
Back to top
Google

Back to top
Display posts from previous:   
Post new topic   Reply to topic Page 1 of 1 [4 Posts] View previous topic :: View next topic
The time now is Fri Jan 09, 2009 1:14 am | All times are GMT
navigation Forum index » Programming » python
Jump to:  

Similar Topics
Topic Author Forum Replies Last Post
No new posts Tkinter focus_set use with grid Stan Cook python 1 Thu Jul 20, 2006 2:53 am
No new posts tkinter help groves python 3 Tue Jul 18, 2006 3:37 pm
No new posts tkinter wm_delete_window yvesd python 1 Tue Jul 18, 2006 9:16 am
No new posts Tkinter StringVar mystery Bob Greschke python 1 Mon Jul 17, 2006 9:00 pm
No new posts Problems with Tkinter and threads claus.tondering@gmail.com python 6 Mon Jul 17, 2006 10:58 am

Read Free Manga Online | Reptile Supplies | Problem Mortgage | Power Rangers | Credit Counseling
Copyright © 2004-2005 DeniX Solutions SRL
 
Other DeniX Solutions sites: Unix/Linux blog |  electronics forum |  medicine forum |  science forum | 
Privacy Policy


Powered by phpBB © 2001, 2005 phpBB Group
[ Time: 0.4290s ][ Queries: 20 (0.3407s) ][ GZIP on - Debug on ]