From: ruby talk Date: 2006-01-12T23:31:29+09:00 Subject: Re: Looking for better Ruby/Tk references... ------=_Part_15703_5231114.1137076275760 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline I am working with tk to, and i find it hard to work with the examples i find. I think the lack of good docs or examples holds me back from somethin= g i would like to do. For example I wish i knew about the TkOptionMenubutton. I created this code this snippet gets the list of files on the hard drive then displays them in the menu. u can go back and forth between folders. When you click a file it adds it to the text box [code] require "tk" def MakeMenu (dir) a=3DArray.new dirarray=3DDir.entries(dir) menu1 =3D TkMenu.new { add 'command', {'label'=3D>"File", 'command'=3D>proc { }} dirarray.each { |ax| if File.file?(dir+"\\"+ax) add 'command', {'label'=3D>ax, 'command'=3D>proc { $Sendfile.value=3D$Sendfile.value+" "+dir.gsub(' ','|')+"\\"+ax}} end if File.directory?(dir+"\\"+ax) and ax !=3D"." and add 'command', {'label'=3D>ax, 'command'=3D>proc {MakeMenu(dir+"\\"+ax)= }} end } } #pop up options menu1.post TkWinfo.pointerx(root) ,TkWinfo.pointery(root) end root=3DTkRoot.new usrname =3D TkVariable.new v1 =3D TkVariable.new $set_to_read =3DTkVariable.new $email_array=3DArray.new password =3D TkVariable.new $Current_id=3DTkVariable.new a=3DArray.new radio_var =3D TkVariable.new('y') $Voice_use=3D TkVariable.new(true) TkFrame.new(root){ $Sendfile=3DTkText.new(self).pack "side"=3D>"top" $Sendfile.width=3D50 $Sendfile.height=3D1 $options=3DTkButton.new(self) {text "files" command { MakeMenu("c:\\") } }.pack "side"=3D>"left" pack}.grid "column"=3D>0,"row"=3D>3 TkFrame.new(root) { }.grid "column"=3D>5, "row"=3D>5, "columnspan"=3D>5,"rowspan"=3D>5 Tk.mainloop [code] It is not as nice looking as a pull down menu, but its neat. I use it for alot of my option menus. On 12/21/05, Chris Dagnon wrote: > > > ... and without answering your other questions, is the following > > link of any use to you? > > > > http://www.jbrowse.com/text/rubytk_en.html > > That is a much better reference than what I've found so far - gives both > an overview and some details, drill-downs for the different levels of > info and even a few implementation examples. Still not every detail I > need (missing TkOptionMenubutton and it's relationship to the whole), > and it is a lot to digest at once. But at least it is a lot :) > > Thanks! > > -Chris > > > Justin Meyer wrote: > > Hi Chris! > > > > On Thu, 22 Dec 2005, Chris Dagnon wrote: > > > > > >>... or better GUI APIs for Ruby. > >>(Primary questions at the bottom) > > > > > > ... well, without stepping into that minefield... > > > > > >>again lacks many of the specifics I need to get the API to work. > >> > http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-talk/138653?help-e= n > > > > > > ... and without answering your other questions, is the following link o= f > > any use to you? > > > > http://www.jbrowse.com/text/rubytk_en.html > > > > I'm no good for further details; I just happened to have that link > > laying around :) > > > > Cheers, > > > > ------=_Part_15703_5231114.1137076275760--