From: bbense+comp.lang.ruby.Jan.22.02@... Date: 2002-01-23T12:33:12+09:00 Subject: Re: Newbie question: RubyTk and Observer ? -----BEGIN PGP SIGNED MESSAGE----- In article , Dave wrote: > >Greetings, > > >So what I'm doing as a first project is that old first-quarter CS >staple, Conway's Life. It should be an interesting exercise in >refactoring, as the first versions will be a naive, slow >implementation with the universe being a 2D array of distinct Cell >objects; then as I learn more I'll move to a Flyweight pattern for the >cells and then a bitmapped universe, etc. etc. > >What I'm wondering about is how I'm going to display the results. I >was thinking of RubyTk, since I've dabbled a little in Tcl/Tk, but >what I can't figure out is how I can make a Tk window an Observer of >my universe. Tk's event-loop model is making me scratch my head. >Once I drop into Tk.mainloop, how the heck am I going to get any Life >processing done? - - I'm not too familiar with the Ruby version of Tk yet, but the standard way to post timed events in Tk is to use the after command. Look in ext/tk/sample/tktimer.rb for examples of how to use Tk.after. - - Booker C. Bense -----BEGIN PGP SIGNATURE----- Version: 2.6.2 iQCVAwUBPE4sygD83u1ILnWNAQGiSwP+JQH8hUhBFTVK3cOFpsk8GXIDF4NS4lW4 3ibX2U0X8IBP9BtMQKPOHECidxytEUlKbk1V8cud8BIeo3boMLDm+ciDzRmBoW4a ReFcF5Uifx6qzpJeUOKCmpJTG37F59YsUKv1TtxD5uJv1A7ayEwbqYAGiwcGuu9Q puuIRLSA13w= =5OUE -----END PGP SIGNATURE----- --