At 08:29 27.08.2004, you wrote:
>hi
>
>if you have several [openpanel]s in a patch, everyone for loading files from a
>separate folder, it could be quite 'search-intensive' to load different
>files, because you always have to go in the rigth folder first.
>is there a solution for this problem like setting a startpath?
>
>by the way something else from my wishlist:
>an option in [openpanel] to set a suffix for a filetype to be visible in the
>opendialog would be great...
i have no pd here right now but using pyext this script should do it
(untested):
save that script into the same dir as your patch and give it the name
"filedialog.py"
make an object [pyext filedialog openpanel].
now you can send messages [dir /tmp( and [ext .wav( to set startpath and
extension
and [open( to open the dialog...
let me know if it works.
sven.
import tkFileDialog
import pyext
class openpanel(pyext._class):
_inlets=1
_outlets=1
def __init__(self):
self.dir = ''
self.ext = ''
def dir_1(self, dir):
self.dir = dir
def ext_1(self,ext):
self.ext = ext
def open_1(self):
f = tkFileDialog.askopenfilename(initialdir = self.dir,
defaultextension = self.ext)
self._outlet(1,f)