From: Phil Mitchell Date: 2002-02-03T07:55:57+09:00 Subject: tk.rb strange behavior?? I have written a simple class (minibuffer.rb) that extends TkFrame, adding label and entry widgets. When I add this modified frame to my root window, it works fine BUT after I close the application I get the following error: /usr/local/lib/ruby/1.6/tk.rb:659:in `_invoke': can't invoke "frame" command: application has been destroyed (RuntimeError) from /usr/local/lib/ruby/1.6/tk.rb:659:in `tk_call' from /usr/local/lib/ruby/1.6/tk.rb:2702:in `create_self' from /usr/local/lib/ruby/1.6/tk.rb:2335:in `initialize' from /usr/local/lib/ruby/1.6/tk.rb:2693:in `initialize' from ./minibuffer.rb:6:in `initialize' from app.rb:9:in `new' from app.rb:9 Note that I don't get the error when I run main from within my class file. minibuffer.rb is enclosed, below: ---------minibuffer.rb------------------ require "tk" class MiniBuffer < TkFrame def initialize(p=nil, params=nil) super(p, params) @parent = p label = TkLabel.new(self) { text('label') } entry = TkEntry.new(self) label.grid('row' => '0', 'column' => '0', 'sticky' => 'ew') entry.grid('row' => '0', 'column' => '1', 'sticky' => 'ew') TkGrid.rowconfigure(self, '0', 'weight' => 1) TkGrid.columnconfigure(self, '0', 'weight' => 1) TkGrid.columnconfigure(self, '1', 'weight' => 5) end end root = TkRoot.new MiniBuffer.new(root, 'borderwidth'=>'5', 'relief'=>'groove').pack('side'=>'top', 'expand'=>1, 'fill' => 'x', 'anchor' => 'n') Tk.mainloop ------------------------------------------------------- But it fails if I call it from app.rb: require "tk" require "minibuffer" root = TkRoot.new MiniBuffer.new(root, 'borderwidth'=>'5', 'relief'=>'groove').pack('side'=>'top', 'expand'=>1, 'fill' => 'x') Tk.mainloop -- sentinel %at pobox $dot com