Basic GUI

D

Don Hanlen

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.
 
M

Michele Simionato

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.

Have a look at the 'processing' module.

Michele Simionato
 
K

kyosohma

Don,

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.


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
 
C

Cameron Laird

.
.
.
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".
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Members online

No members online now.

Forum statistics

Threads
474,220
Messages
2,571,128
Members
47,744
Latest member
FrederickM

Latest Threads

Top