tk file dialog and directories

A

Ara.T.Howard

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 :: http://www.ngdc.noaa.gov/stp/
| 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'
===============================================================================
 
H

Hidetoshi NAGAI

Hi,

From: "Ara.T.Howard" <[email protected]>
Subject: tk file dialog and directories
Date: Sat, 20 Dec 2003 10:11:53 +0900
Message-ID: said:
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.
 
A

Ara.T.Howard

Date: Sun, 21 Dec 2003 00:35:37 +0900
From: Hidetoshi NAGAI <[email protected]>
Newsgroups: comp.lang.ruby
Subject: Re: tk file dialog and directories

Hi,

From: "Ara.T.Howard" <[email protected]>
Subject: tk file dialog and directories
Date: Sat, 20 Dec 2003 10:11:53 +0900


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


thanks!

-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 :: http://www.ngdc.noaa.gov/stp/
| 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'
===============================================================================
 
O

Osuka Adartse

Ara.T.Howard said:
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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

puts(derived_from_array) 0
[RCR] Kernel#hostname 0
io/nonblock 4
make MISSING=flock.o 0
flock vs fcntl and nfs 0
42.type and TypeError or 42.class and ClassError 6
ruby advocacy 3
timeout w/o timeout.rb 3

Members online

No members online now.

Forum statistics

Threads
473,770
Messages
2,569,586
Members
45,083
Latest member
SylviaHarr

Latest Threads

Top