From: Hidetoshi NAGAI Date: 2005-01-13T13:07:44+09:00 Subject: Re: Run TCL in ruby From: tony summerfelt Subject: Re: Run TCL in ruby Date: Thu, 13 Jan 2005 12:22:34 +0900 Message-ID: > although i really like the syntax: > > Tk.tk_call('source', 'gui.tcl') > > gui.tcl contains the entire interface for the program, but i would > like the -command associated with each button to execute ruby code, > not tcl code...i also need to get all the text from a tcl text > widget... If you know the widget path on the tcl script and don't need to use the Tcl code associated -command option, those are very easy. When the widget path of the button is .foo.bar.btn and the path of the text is .baz.txt, for example, ------------------------------------------------------------------------ Tk.tk_call('source', 'gui.tcl') def show_text(txt) p txt.value end txt = TkText.new(:widgetname=>'.baz.txt', :without_creating=>true) b = TkButton.new(:widgetname=>'.foo.bar.btn', :without_creating=>true) b.command(proc{ show_text(txt) }) # or b.command{ show_text(txt) } # or # TkButton.new(:widgetname=>'.foo.bar.btn', :without_creating=>true){ # command { show_text(txt) } # } Tk.mainloop ------------------------------------------------------------------------ -- Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)