From: Hidetoshi NAGAI Date: 2004-02-24T01:01:43+09:00 Subject: Re: Graphical Ruby/Tk GUI designer? Hi, From: Thomas Adam Subject: Re: Graphical Ruby/Tk GUI designer? Date: Mon, 23 Feb 2004 06:51:00 +0900 Message-ID: <20040222215053.4607.qmail@web41109.mail.yahoo.com> > [n6tadam@laptop n6tadam]$ apt-cache show visual-tcl > Description: Tcl GUI builder > Visual Tcl is a freely-available, high-quality application development > environment. Written entirely in Tcl and generating pure Tcl should make > porting either unnecessary or trivial. Visual Tcl is covered by the GNU > General Public License insuring that it will remain in the capable hands > of the internet community. Visual Tcl has no relation to SCO Visual Tcl > or > the FREE Visual Tcl/Tk project. > > Package name: visual-tcl Ruby/Tk can load a Tcl script on its Tk interpreter. Therefore, you'll be able to use the output script of the GUI builder. It is not difficult to control widgets generated by the tcl script. For example, when there is a Tcl/Tk script 'entry.tcl' as below, -----< entry.tcl >------------------------------------ #!/usr/bin/wish wm geometry . +30+30 frame .buttons pack .buttons -side top -fill x button .buttons.quit -text Quit -command exit button .buttons.print -text Print -command {puts $e_val} pack .buttons.quit .buttons.reset -side right entry .buttons.e -textvariable e_val -relief sunken pack .buttons.e -side left -fill x ------------------------------------------------------ you can load the script to Ruby/Tk and control widgets (generated by the script) along the following lines. ------------------------------------------------------ $ /usr/local/bin/irb -r tk irb(main):001:0> Tk.tk_call('source', 'entry.tcl') => "" irb(main):002:0> root = TkRoot.new => # irb(main):003:0> root.winfo_children => [#] irb(main):004:0> widgets = root.winfo_children[0].winfo_children => [#, #, #] irb(main):005:0> btn_q, btn_p, ent = widgets => [#, #, #] irb(main):006:0> ent['textvariable'] => "e_val" irb(main):007:0> v = TkVarAccess.new(ent['textvariable']) => # irb(main):008:0> v.value = 'foo bar' => "foo bar" irb(main):009:0> btn_p.invoke foo bar => "" irb(main):010:0> Tk.mainloop ------------------------------------------------------ -- Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)