Tk file dialog and directories

rtk’rs-

anyone know how to make file dialogs allow the seletion of directories?
example code out there?

-a

···

ATTN: please update your address books with address below!

===============================================================================

EMAIL :: Ara [dot] T [dot] Howard [at] noaa [dot] gov
PHONE :: 303.497.6469
ADDRESS :: E/GC2 325 Broadway, Boulder, CO 80305-3328
STP :: Solar-Terrestrial Physics Data | NCEI
NGDC :: http://www.ngdc.noaa.gov/
NESDIS :: http://www.nesdis.noaa.gov/
NOAA :: http://www.noaa.gov/
US DOC :: http://www.commerce.gov/

The difference between art and science is that science is what we
understand well enough to explain to a computer.
Art is everything else.
– Donald Knuth, “Discover”

/bin/sh -c ‘for l in ruby perl;do $l -e “print "\x3a\x2d\x29\x0a"”;done’
===============================================================================

Hi,

···

From: “Ara.T.Howard” ahoward@ngdc.noaa.gov
Subject: tk file dialog and directories
Date: Sat, 20 Dec 2003 10:11:53 +0900
Message-ID: Pine.LNX.4.44.0312191644050.25332-100000@fattire.ngdc.noaa.gov

anyone know how to make file dialogs allow the seletion of directories?
example code out there?

If you use Tk8.3+, please use ‘Tk.chooseDirectory’ method.

                              Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)

thanks!

-a

···

On Sun, 21 Dec 2003, Hidetoshi NAGAI wrote:

Date: Sun, 21 Dec 2003 00:35:37 +0900
From: Hidetoshi NAGAI nagai@ai.kyutech.ac.jp
Newsgroups: comp.lang.ruby
Subject: Re: tk file dialog and directories

Hi,

From: “Ara.T.Howard” ahoward@ngdc.noaa.gov
Subject: tk file dialog and directories
Date: Sat, 20 Dec 2003 10:11:53 +0900
Message-ID: Pine.LNX.4.44.0312191644050.25332-100000@fattire.ngdc.noaa.gov

anyone know how to make file dialogs allow the seletion of directories?
example code out there?

If you use Tk8.3+, please use ‘Tk.chooseDirectory’ method.

ATTN: please update your address books with address below!

===============================================================================

EMAIL :: Ara [dot] T [dot] Howard [at] noaa [dot] gov
PHONE :: 303.497.6469
ADDRESS :: E/GC2 325 Broadway, Boulder, CO 80305-3328
STP :: Solar-Terrestrial Physics Data | NCEI
NGDC :: http://www.ngdc.noaa.gov/
NESDIS :: http://www.nesdis.noaa.gov/
NOAA :: http://www.noaa.gov/
US DOC :: http://www.commerce.gov/

The difference between art and science is that science is what we
understand well enough to explain to a computer.
Art is everything else.
– Donald Knuth, “Discover”

/bin/sh -c ‘for l in ruby perl;do $l -e “print "\x3a\x2d\x29\x0a"”;done’
===============================================================================

Ara.T.Howard wrote:

Date: Sun, 21 Dec 2003 00:35:37 +0900
From: Hidetoshi NAGAI nagai@ai.kyutech.ac.jp
Newsgroups: comp.lang.ruby
Subject: Re: tk file dialog and directories

Hi,

From: “Ara.T.Howard” ahoward@ngdc.noaa.gov
Subject: tk file dialog and directories
Date: Sat, 20 Dec 2003 10:11:53 +0900
Message-ID: Pine.LNX.4.44.0312191644050.25332-100000@fattire.ngdc.noaa.gov

anyone know how to make file dialogs allow the seletion of directories?
example code out there?

If you use Tk8.3+, please use ‘Tk.chooseDirectory’ method.

thanks!

-a
A lil’ example I cooked someday, works in linux/windows(using tk8.4.4).
the idea was select a dir with mp3’s

#!/usr/local/bin/ruby
require ‘tk’
require ‘tkscrollbox’
Dir.chdir(‘/dev’)
bdir=TkVariable.new(value=Dir.getwd)
mywin=TkRoot.new{title ‘My Test ver 0.02’;
resizable(1,1);
minsize(640,480);
maxsize(640,480);
background ‘#DFEFF9’}
flist=TkScrollbox.new(mywin){
relief ‘groove’
width 40
height 80
background ‘#FFFFEA
foreground ‘#0000AA
pack(‘side’=>‘left’)}
TkButton.new(mywin){

bitmap TkPhotoImage.new(‘file’=>[‘f:/dev/aIcon.GIF’])

text ‘Change Directory’
command {
bdir.value=Tk.chooseDirectory
Dir.chdir(bdir.value)
flist.delete 0,‘end’
flist.insert 0,Dir['.mp3’].sort!
flist.activate(0)
pack
}
pack
}
flist.insert ‘end’,Dir['.mp3’].sort!
flist.focus
flist.activate(0)
flist.bind “Control-q”, proc{exit}
flist.bind “Double-Button-1”, proc{print ‘clicked:
‘,bdir.value,’/’,TkSelection.get,“\n”}
Tk.mainloop
#print “\n”,bdir.value

···

On Sun, 21 Dec 2003, Hidetoshi NAGAI wrote: