From: Tait Pollard Date: 2006-06-23T02:43:13+09:00 Subject: Re: while in a tk mainloop Stuart Brand wrote: >> What exactly are you trying to do inside the while loop? >> depending on what you are trying to do more than likely there is a way >> to do it without the loop. I might be able to help if i know more about >> what you are trying to do. > > Hi > > Sure, > > server = TCPServer.new('0.0.0.0', 8080) > while (session = server.accept) > Thread.new{MainServer.handle_connection(session)} > end > > The while loop is for new connection and the Tk loop would be to show > the status > > Many thanks > > Stuart Well the only thing I can think of is to incapsulate it inside a class and initialize method like class foo def initialize #your tk code and while loop end end foo.new Tk.mainloop that way everything gets read and the while loop won't start till the Tk.mainloop is called. This should work if you adapt it right, hopefully. Hope this helps. Tait Pollard -- Posted via http://www.ruby-forum.com/.