From: SpringFlowers AutumnMoon Date: 2007-09-24T20:34:26+09:00 Subject: Re: how to use Ruby / Tk to display a text message status bo Alex Fenton wrote: > SpringFlowers AutumnMoon wrote: >> how can we pop up a Tk window to display the temporary results of a >> program? > When you call "mainloop", you're telling Tk (and other GUIs, too) to > wait for the user to do something (eg click a button). This is sometimes > called an "event loop". As the "loop" name suggests, the program stops > at this point and nothing further will be run until the GUI is ended. > > To run other tasks (such as your calculation) concurrently with the > event loop, start those other tasks in a ruby Thread alongside the GUI > code. Then, if you want to display intermediate results from that task > in the GUI, pass messages between the task thread to the main GUI > thread. Again, there's numerous different ways to do this. what about not calling the MainLoop but just keep on painting on the GUI window? For example, like in Win 32, I had a program that just popped out a window and then I just keep on using DrawText to paint the result. The whole program doesn't need to have any event driven handling. just drawing text to a window. -- Posted via http://www.ruby-forum.com/.