Re: Basic GUI

2007-09-12 Thread kyosohma
Don,

On Sep 11, 10:54 pm, Don Hanlen [EMAIL PROTECTED] wrote:
 I'm writing a simple GUI that:
 ..gets info via telnet protocol (and sends)
 ..gets info via http (and sends)
 ..gets user-info from (currently)
 ...Tkinter Text windoze
 ...Tkinter buttons and such
 ..displays info in various Tkinter windoze
 ...graphic AND text...

 I can accomplish all of these functions individually and now seem to
 need to set up multi-processes to combine 'em.  Back in my C days, I'd
 have used fork/exec to do so, but I'm confused by the number of
 modules available in Python.  Is there a best for portability and
 simplicity?  (Or am I on the wrong track here?)

 I could solve my problems with the following psuedo-code made into
 real code:
 
 import blah

 t = blah.fork(runthisprogram.py)

 #OK still in main
 t.sendinfo(info)
 info = t.receiveinfo()
 
 #runthisprogram.py
 def sendinfobacktopapa():
 ? eventhere
 def getinfofrompapa():
 ? eventhere
 

 It seems to me that propagating events *may* be the best way to
 communicate.  I'm wide open, including to non-multi-process solutions.

 Thanks for your comments, I searched old posts for a while, various
 other Python info-sources, and couldn't find an answer.
 --
 don


You can also use threads, which is a little bit more portable than
using Python's fork methodology, or so I've read. The concepts on this
page can be applied to any GUI toolkit you choose:
http://wiki.wxpython.org/LongRunningTasks

I've used them with wxPython, but iirc, Lutz does something quite
similar with Tkinter in his latest edition of Programming Python.

I think what Michele is referring to is the subprocess module, which
is also useful.

Mike

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Basic GUI

2007-09-12 Thread Cameron Laird
In article [EMAIL PROTECTED],
 [EMAIL PROTECTED] wrote:
.
.
.
You can also use threads, which is a little bit more portable than
using Python's fork methodology, or so I've read. The concepts on this
page can be applied to any GUI toolkit you choose:
http://wiki.wxpython.org/LongRunningTasks

I've used them with wxPython, but iirc, Lutz does something quite
similar with Tkinter in his latest edition of Programming Python.

I think what Michele is referring to is the subprocess module, which
is also useful.

Mike


Let's make it even more definite:  read URL:
http://docs.python.org/lib/module-subprocess.html 
for details about the subprocess module.

Don, you describe do-something-and-retrieve-the-
results, and ask about inter-task communications.
We can give more pointed advice with just a few more
details:  is it OK for your application to block 
during a do-something-and-retrieve-the-results
sequence?  Is it acceptable, for example, that some-
one push a button on your GUI, Python directs an HTTP
query, then the GUI freezes until the answer returns?
If your application can behave so, the programming
will be more direct than if you require the retrievals
to be done in the background while the GUI remains
live.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Basic GUI

2007-09-11 Thread Michele Simionato
On Sep 11, 11:54 pm, Don Hanlen [EMAIL PROTECTED] wrote:
 I could solve my problems with the following psuedo-code made into
 real code:
 
 import blah

 t = blah.fork(runthisprogram.py)

 #OK still in main
 t.sendinfo(info)
 info = t.receiveinfo()
 
 #runthisprogram.py
 def sendinfobacktopapa():
 ? eventhere
 def getinfofrompapa():
 ? eventhere
 

 It seems to me that propagating events *may* be the best way to
 communicate.  I'm wide open, including to non-multi-process solutions.

 Thanks for your comments, I searched old posts for a while, various
 other Python info-sources, and couldn't find an answer.
 --
 don

Have a look at the 'processing' module.

Michele Simionato

-- 
http://mail.python.org/mailman/listinfo/python-list