From: bbense+comp.lang.ruby.Mar.31.02@... Date: 2002-04-01T01:48:32+09:00 Subject: Re: Error calling Tk in a loop -----BEGIN PGP SIGNED MESSAGE----- In article , wrote: > > >> -----Original Message----- >> From: Hal E. Fulton [mailto:hal9000@hypermetrics.com] >> > > >> Hmm... I tried adding a Quit button, then using a thread >> (for mainloop) or a continuation. Neither worked for me. > >>From poking around Google I've found that others have similar errors, and >it's noit Ruby-specific. >As best I can tell, both clicking the 'x' and using a close button should >send a 'destroy' message, but something isn't getting reset correctly. So, > > root = TkRoot.new { title caption.to_s } > >doesn't really create a new object; something in Tk fails to reinitilaize, >so the code thinks the Tk app is still destroyed. > >Or something like that :} > >I don't like the idea of spawning a process for this, but that might ensure >that each call gets a fresh instance. > - - There should only be one TkRoot per display. As others have said Tk has it's own event loop. In order for things to work correctly you need to schedule events within Tk's event loop. You do this by either binding key/mouse events or using the after method. - - Booker C. Bense -----BEGIN PGP SIGNATURE----- Version: 2.6.2 iQCVAwUBPKc4VwD83u1ILnWNAQFO+QP/W6vynYzF9NllDRrpvNT6/l/1DClFDTfv d9b+o2SqhG3XBOCHnP/pck87SS41coDJlsm7vsuxfUQKkv3YnZafl06J4HBCEeA5 4MXmh7mtVD1RvYlSikShdeicW/8r4U9vLcFxqY3QnIwp1cjW27XpwH3OQNXGKh+T M5ZLlm9/t+Q= =Hr6y -----END PGP SIGNATURE----- --