From: mgushee@... Date: 2003-03-11T14:13:09+09:00 Subject: Re: [Q] How to destroy a TkToplevel window On 11 Mar 2003 at 13:02, Daniel Carrera wrote: > Actually, just replacing: > > button_quit.bind("ButtonRelease-1") { dialog.destroy } > > by > > button_quit.configure("command" => Proc.new { dialog.destroy } ) > > Works. I wonder why that is. Well, I believe in the first case dialog.destroy gets evaluated at the time the binding is set. But then you would think that the dialog should never get displayed at all. So I'm not quite sure what's going on there. In my experiment, it also seemed to make a difference whether you pass the command as an argument to the constructor or in a separate call to Button::configure. That shouldn't have any effect on the behavior of the command; I've been working with Tk for several years in Tcl and Python, and I'm pretty sure it doesn't make a difference in either of those languages, so maybe it's a bug in Ruby/Tk. Or maybe you have to vary the syntax a little due to some peculiarity of blocks in Ruby. -- Matt Gushee Englewood, CO USA