1require 'tk' 2 3class Button_with_Frame < TkButton 4 def create_self(keys) 5 @frame = TkFrame.new('widgetname'=>@path, 'background'=>'yellow') 6 install_win(@path) # create new @path which is a daughter of old @path 7 super(keys) 8 TkPack(@path, :padx=>7, :pady=>7) 9 @epath = @frame.path 10 end 11 def epath 12 @epath 13 end 14end 15 16Button_with_Frame.new(:text=>'QUIT', :command=>proc{exit}) { 17 pack(:padx=>15, :pady=>5) 18} 19 20Tk.mainloop 21