Basic GUI
kyosohma at gmail.com
kyosohma at gmail.com
Wed Sep 12 09:17:53 EDT 2007
Don,
On Sep 11, 10:54 pm, Don Hanlen <dhan... at owt.com> 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
More information about the Python-list
mailing list