> I am building a GUI for a scaling application that every
>few milliseconds outputs four or five lines of status information
>on how each Client is proceeding etc.etc.
Milliseconds? Like, hundreds of milliseconds, right? ^_^;
> I've got the layout, buttons, menus etc. all laid out as I
>wish. My only problem is how to periodically have the
>app. write to the console window (a GtkText and GtkScrollbar
>in a GtkVbox).
Might want to put the GtkText in a GtkScrolledWindow instead; it will
link up all the adjustment stuff, and lets you specify how the scroll
bars are hidden or shown.
> Basically it forks a child process that tries to write to the
>console while the parent spins on GTK mainloop() or something
>close to it....Here's what happened for various parent/child
>scenarios (the complete app appears at the end of my mail)
>
>(1)
>
> pid = os.fork()
> if pid != 0:
> mainloop()
> else:
> for ndx in range(1,100):
> text.insert (title,text.fg,text.bg,' Starting subscriber
>'+str(ndx)+'\n' )
> os._exit(0)
>
> Messages from only the first two subscribers appear. The window
> won't go away, the destroy() handler is not being called?
_exit() skips all Gtk cleanup. I'm not sure about that code, because
I don't think that Gtk will live on both sides of a fork(). Usually,
people use fork() to kick off a child which turns around and calls
one of the exec routines.
Your code looks like it tries to get two processes to share the Gtk
connection to X. I suggest making the child into its own program
which gets exec'd, or confining all Gtk work to the parent and put
the non-Gtk stuff in the children.
>(2)
>
> pid = os.fork()
> if pid != 0:
> while(1):
> win.show_all()
> else:
> for ndx in range(1,100):
> text.insert (title,text.fg,text.bg,' Starting subscriber
>'+str(ndx)+'\n' )
> os._exit(0)
>
> I get the desired result!! All subscriber messages appear...*but* I can't
>kill the
>app, destroy the window etc.etc. no events being handled obivously....
Wow. Same situation as above, two processes hooked to the same end
of a socket. Undefined behavior... ^_^;
Something else you could try is importing Gtk into each process
_after_ you fork, which should give each process its own connections.
--
_______________________________________________
pygtk mailing list [EMAIL PROTECTED]
http://www.daa.com.au/mailman/listinfo/pygtk