Thought this would be simple :)

Hello Jeff:

There are many different approaches you can take to communicating
between your telnet code and the text control. One would be to create
the wx.Frame in your main module, and save a reference to it there.
You could then implement a method of the Frame to replace or append
to the wx.TextCtrl.

A more elegant method, in my opinion, is to use pyDispatcher. You set
up a method to receive messages in the GUI code, and a then send a
message in your main code any time you want to update the wx.TextCtrl.

···

On 10/31/05, Jeff Howard <jhoward1@nc.rr.com> wrote:

Hi - I'm new to Python and wxPython. I've written a Python program that
opens some
telnet ports and sends and receives data. I wanted to create a "simple"
window
I could pop-up (Windows and Linux) that I could then write data to in real
time so that
users could see what was transpiring on the telnet ports. The window just
has to have
one scrollable multiline text field and an exit button. These windows need
to pop up
when my program starts and then stay around so I can periodically send text
to them.

I've tried a number of times and can get a window to pop up with static,
predefined
text in it but can't figure out a way to pop-up a window and then write to
it dynamically.

Below is a modified version of a program I found on the serpia website. I
started with
this (and a number of others) but most examples I've seen are standalone
programs
that I don't see how to access from my existing program. Thanks in advance
for
any help!

- Jeff H.

Youre right. I pretty much always just use wx.CallAfter() to
queue up calls to widget methods to update the displayed data.
I've never run into any issues with that scheme.

···

On 2005-11-01, Michael Moriarity <datasmith@gmail.com> wrote:

2. The cleaner, but somewhat more complicated solution is to give
the long-running task its own thread, so that the GUI thread can
continue to be responsive without any special effort. In this case,
the long running task will have to communicate back to the GUI
thread the information to be displayed in the wx.TextCtrl. I have
used a lockable, shared object for this pupose, which I have the
GUI poll once or twice a second, but most people would probably
use wx.PostEvent() or wx.CallAfter().

--
Grant Edwards grante Yow! I love FRUIT
                                  at PICKERS!!
                               visi.com