新井です。

ruby 1.5でハッシュの値にnilが許されるようになってtk.rbで不具
合がありました。パッチ付けます(まだあるかも)

@screen -> @visual という修正も含んでるので1.4でもあててください。

# 最近Ruby/Tkべったりです。ちょいと仕事絡みなのですが、世界
# 中でこれ使ってるの私だけ?とか思っちゃいそう。ちょっと孤独
# (愚痴っぽいなぁ^^;)


$ ruby -v -rtk -e 'TkToplevel.new(nil, {"classname"=>"HOGE"})' -e Tk.mainloop ruby 1.5.0 (1999-12-07) [i586-linux] /usr/local/lib/ruby/1.5/tk.rb:1912: warning: instance var @colormap not initialized /usr/local/lib/ruby/1.5/tk.rb:1913: warning: instance var @container not initialized /usr/local/lib/ruby/1.5/tk.rb:1914: warning: instance var @screen not initialized /usr/local/lib/ruby/1.5/tk.rb:1915: warning: instance var @use not initialized /usr/local/lib/ruby/1.5/tk.rb:1916: warning: instance var @visual not initialized /usr/local/lib/ruby/1.5/tk.rb:510:in `_invoke': unknown option "-classname" (RuntimeError) from /usr/local/lib/ruby/1.5/tk.rb:510:in `tk_call' from /usr/local/lib/ruby/1.5/tk.rb:1599:in `configure' from /usr/local/lib/ruby/1.5/tk.rb:1685:in `initialize' from /usr/local/lib/ruby/1.5/tk.rb:1906:in `initialize' from -e:1:in `new' from -e:1 Index: ext/tk/lib/tk.rb =================================================================== RCS file: /home/cvs/ruby/ext/tk/lib/tk.rb,v retrieving revision 1.5 diff -u -p -u -r1.5 tk.rb --- ext/tk/lib/tk.rb 1999/12/14 06:49:57 1.5 +++ ext/tk/lib/tk.rb 1999/12/14 13:46:36 @@ -1452,24 +1452,20 @@ module TkTreatFont alias fontobj font_configinfo def font_configure(slot) - if (fnt = slot['font']) - slot['font'] = nil + if (fnt = slot.delete('font')) if fnt.kind_of? TkFont return fnt.call_font_configure(self.path, self.path,'configure',slot) else latinfont_configure(fnt) if fnt end end - if (ltn = slot['latinfont']) - slot['latinfont'] = nil + if (ltn = slot.delete('latinfont')) latinfont_configure(ltn) if ltn end - if (ltn = slot['asciifont']) - slot['asciifont'] = nil + if (ltn = slot.delete('asciifont')) latinfont_configure(ltn) if ltn end - if (knj = slot['kanjifont']) - slot['kanjifont'] = nil + if (knj = slot.delete('kanjifont')) kanjifont_configure(knj) if knj end @@ -1878,30 +1874,12 @@ class TkToplevel<TkWindow @classname = classname if keys.kind_of? Hash keys = keys.dup - if keys['classname'] - @classname = keys['classname'] - keys['classname'] = nil - end - if keys['colormap'] - @colormap = keys['colormap'] - keys['colormap'] = nil - end - if keys['container'] - @classname = keys['container'] - keys['classname'] = nil - end - if keys['screen'] - @screen = keys['screen'] - keys['screen'] = nil - end - if keys['use'] - @use = keys['use'] - keys['use'] = nil - end - if keys['visual'] - @screen = keys['visual'] - keys['visual'] = nil - end + @classname = keys.delete('classname') + @colormap = keys.delete('colormap') + @classname = keys.delete('container') + @screen = keys.delete('screen') + @use = keys.delete('use') + @visual = keys.delete('visual') end super(parent, keys) end @@ -1932,22 +1910,10 @@ class TkFrame<TkWindow def initialize(parent=nil, keys=nil) if keys.kind_of? Hash keys = keys.dup - if keys['classname'] - @classname = keys['classname'] - keys['classname'] = nil - end - if keys['colormap'] - @colormap = keys['colormap'] - keys['colormap'] = nil - end - if keys['container'] - @classname = keys['container'] - keys['classname'] = nil - end - if keys['visual'] - @screen = keys['visual'] - keys['visual'] = nil - end + @classname = keys.delete('classname') + @colormap = keys.delete('colormap') + @classname = keys.delete('container') + @screen = keys.delete('visual') end super(parent, keys) end @@ -2189,8 +2155,7 @@ module TkTreatMenuEntryFont def tagfont_configure(index, slot) pathname = self.path + ';' + index - if (fnt = slot['font']) - slot['font'] = nil + if (fnt = slot.delete('font')) if fnt.kind_of? TkFont return fnt.call_font_configure(pathname, self.path,'entryconfigure',index,slot) @@ -2198,16 +2163,13 @@ module TkTreatMenuEntryFont latintagfont_configure(index, fnt) if fnt end end - if (ltn = slot['latinfont']) - slot['latinfont'] = nil + if (ltn = slot.delete('latinfont')) latintagfont_configure(index, ltn) if ltn end - if (ltn = slot['asciifont']) - slot['asciifont'] = nil + if (ltn = slot.delete('asciifont')) latintagfont_configure(index, ltn) if ltn end - if (knj = slot['kanjifont']) - slot['kanjifont'] = nil + if (knj = slot.delete('kanjifont')) kanjitagfont_configure(index, knj) if knj end Index: ext/tk/lib/tkcanvas.rb =================================================================== RCS file: /home/cvs/ruby/ext/tk/lib/tkcanvas.rb,v retrieving revision 1.4 diff -u -p -u -r1.4 tkcanvas.rb --- ext/tk/lib/tkcanvas.rb 1999/12/06 09:04:01 1.4 +++ ext/tk/lib/tkcanvas.rb 1999/12/14 13:46:37 @@ -30,8 +30,7 @@ module TkTreatCItemFont else pathname = self.path + ';' + tagOrId.to_s end - if (fnt = slot['font']) - slot['font'] = nil + if (fnt = slot.delete('font')) if fnt.kind_of? TkFont return fnt.call_font_configure(pathname, self.path,'itemconfigure',tagOrId,slot) @@ -39,16 +38,13 @@ module TkTreatCItemFont latintagfont_configure(tagOrId, fnt) if fnt end end - if (ltn = slot['latinfont']) - slot['latinfont'] = nil + if (ltn = slot.delete('latinfont')) latintagfont_configure(tagOrId, ltn) if ltn end - if (ltn = slot['asciifont']) - slot['asciifont'] = nil + if (ltn = slot.delete('asciifont')) latintagfont_configure(tagOrId, ltn) if ltn end - if (knj = slot['kanjifont']) - slot['kanjifont'] = nil + if (knj = slot.delete('kanjifont')) kanjitagfont_configure(tagOrId, knj) if knj end Index: ext/tk/lib/tktext.rb =================================================================== RCS file: /home/cvs/ruby/ext/tk/lib/tktext.rb,v retrieving revision 1.3 diff -u -p -u -r1.3 tktext.rb --- ext/tk/lib/tktext.rb 1999/08/24 08:21:56 1.3 +++ ext/tk/lib/tktext.rb 1999/12/14 13:46:38 @@ -28,8 +28,7 @@ module TkTreatTextTagFont else pathname = self.path + ';' + tag end - if (fnt = slot['font']) - slot['font'] = nil + if (fnt = slot.delete('font')) if fnt.kind_of? TkFont return fnt.call_font_configure(pathname, self.path,'tag','configure',tag,slot) @@ -37,16 +36,13 @@ module TkTreatTextTagFont latintagfont_configure(tag, fnt) if fnt end end - if (ltn = slot['latinfont']) - slot['latinfont'] = nil + if (ltn = slot.delete('latinfont')) latintagfont_configure(tag, ltn) if ltn end - if (ltn = slot['asciifont']) - slot['asciifont'] = nil + if (ltn = slot.delete('asciifont')) latintagfont_configure(tag, ltn) if ltn end - if (knj = slot['kanjifont']) - slot['kanjifont'] = nil + if (knj = slot.delete('kanjifont')) kanjitagfont_configure(tag, knj) if knj end