Python Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming LanguagesPython Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old June 7th, 2004, 11:21 AM
winwin winwin is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: May 2004
Posts: 21 winwin User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
signals and thread communication

Hi,

I am writing a graphical interface with Tkinter that prints on a text zone the results of another script that is quite long and tales some time.
The problem is that if I use popen4 I don't know when something was written and I only get te results at the end, at that point it is useless to have control text being printed.
I would like to use spawn but I don't know how to make two processes communicated (the child process sends a signal to say that he sends something in a pipe, and then the parent process reads the pipe).
Could you help me out here, please? If you have any ideas of how to do it differently, I'm open too...

thanks,
erwin

Reply With Quote
  #2  
Old June 7th, 2004, 12:37 PM
Grim Archon's Avatar
Grim Archon Grim Archon is offline
Mini me.
Dev Shed Novice (500 - 999 posts)
 
Join Date: Nov 2003
Location: Cambridge, UK
Posts: 783 Grim Archon User rank is Corporal (100 - 500 Reputation Level)Grim Archon User rank is Corporal (100 - 500 Reputation Level)Grim Archon User rank is Corporal (100 - 500 Reputation Level)Grim Archon User rank is Corporal (100 - 500 Reputation Level)  Folding Points: 1488 Folding Title: Novice Folder
Time spent in forums: 3 Days 2 h 15 m 57 sec
Reputation Power: 7
Send a message via MSN to Grim Archon
My preference would be to re-write the results generating script to optionally direct it's output to a socket (UDP) and and have your Tkinter app read the socket on a loop using the after method. That way neither app should lock the other.

I've not used pipes under Linux but I did simulate it with files under Windows - not very nice.

You can still use the popen module (my preference is the popen2.popen4 class as it wraps thing nicely) to launch the results-app and use it to monitor the process id for application termination.

grim
__________________
*** Experimental Python Markup CGI V2 ***

Last edited by Grim Archon : June 7th, 2004 at 12:42 PM.

Reply With Quote
  #3  
Old June 8th, 2004, 08:34 AM
winwin winwin is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: May 2004
Posts: 21 winwin User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Thanks!

I didn't know about sockets before, it's great!
erwin

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming LanguagesPython Programming > signals and thread communication


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 5 hosted by Hostway
Stay green...Green IT