From: Joel VanderWerf Date: 2002-02-07T06:05:44+09:00 Subject: combining Tk and irb as interfaces to app Hi, What's the best way to use both Tk and the irb command line as interfaces to a ruby program? I've considered these: 1. Run Tk.mainloop in a thread within irb (as in ruby-talk 18064). The problem is that unless the thread has the same priority as the main irb thread, one or the other starves. If they have the same priority, Tk runs fine, and the irb command line works, but irb gets very slow even if Tk is idle. 2. Run irb in a Tk window, sort of like the Turtle example (ruby-talk 15217). In that example, the GUI freezes when you execute a typed command. I haven't tried using threads, but I would expect the same problem as in 1. Another problem is that local vars don't persist in the listener, and in general it is less friendly than irb. 3. Don't use threads, but instead call Tcl_DoOneEvent somewhere. 4. Fork and use druby to communicate between the Tk-based GUI and the irb-based CLI. Any suggestions? If it helps, my app is an environment for interacting with the evolution of a simulation. The user should be able to execute commands and scripts from the command line, and also to use some Tk windows to inspect the state of the simulation and also issue simple commands like 'run', 'stop'. etc. -- Joel VanderWerf California PATH, UC Berkeley mailto:vjoel@path.berkeley.edu Ph. (510) 231-9446 http://www.path.berkeley.edu FAX (510) 231-9512