From: Hiramatu Yoshifumi Date: 1998-06-10T13:08:49+09:00 Subject: [ruby-list:8262] TkGrid do not exist? 平松です。 tk には grid というジオメトリマネージャがあって pack よりも便利な 場合も多いです。が、Ruby/Tk には grid に対応するクラスは無いよう です。作ること自体はあまり難しくないようですが…… 以下が「あまり難しくない」の根拠です。TkPack のまねをしています。 require "tk" class TkGrid include Tk extend Tk def TkGrid.configure(widget, *args) if args[-1].kind_of?(Hash) keys = args.pop end wins = [widget.path] for i in args wins.push i.epath end tk_call "grid", 'configure', *(wins+hash_kv(keys)) end def TkGrid.add(widget, *args) TkGrid.configure(widget, *args) end def TkGrid.forget(*args) tk_call 'grid', 'forget', *args end def TkGrid.propagate(master, bool=None) bool(tk_call('grid', 'propagate', master.epath, bool)) end end l1 = TkLabel.new { text "hello" } TkGrid.add(l1, 'column'=>'0', 'row'=>'0') Tk.mainloop -- // 平松祥史(Hiramatu,Yoshifumi) // hiramatu@cdrom.co.jp