[PD] can i somehow set a startpath for [openpanel]?

sven ml.sven at subscience.de
Sat Aug 28 18:51:05 CEST 2004

At 08:29 27.08.2004, you wrote:
>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 
save that script into the same dir as your patch and give it the name 
make an object [pyext filedialog openpanel].
now you can send messages [dir /tmp( and [ext .wav( to set startpath and 
and [open( to open the dialog...
let me know if it works.

import tkFileDialog
import pyext

class openpanel(pyext._class):

         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)

More information about the Pd-list mailing list