filebrowsebutton changecallback

  • Sven Smiles

    Sven Smiles - 2010-06-09

    (actually DirBrowseButton) I set it up in the frame editor but how how I set up changecallback? I edited into the generated code

            self.dirBrowseRoot = wx.lib.filebrowsebutton.DirBrowseButton(buttonText='Browse',
                  dialogTitle='', id=wxID_FRAME1DIRBROWSEROOT, labelText='',
                  newDirectory=False, parent=self.window1, pos=wx.Point(24, 32),
                  size=wx.Size(320, 40), startDirectory='c:\\',
                  toolTip='Type directory name or browse to select',
                  changeCallback = self.dirBrowseRootChangeCallback)

    and that does what I want but then when I run the frame editor it gives an error
    AttributeError: dirBrowseRootChangeCallback

  • Werner F. Bruhin

    You should probably be able to do this:

            self.dirBrowseButton1 = wx.lib.filebrowsebutton.DirBrowseButton(buttonText='Browse',
                  dialogTitle='', id=wxID_DIALOG1DIRBROWSEBUTTON1,
                  labelText='Select a directory:', newDirectory=False, parent=self,
                  pos=wx.Point(40, 16), size=wx.Size(296, 48), startDirectory='.',
                  toolTip='Type directory name or browse to select')

        def __init__(self, parent):
            self.dirBrowseButton1.changeCallBack = yourCallBack

    It would be nice if FileBrowser would have a setter/getter for this, I believe then Boa could handle this better.  There might also be a way to adapt Boa's Companions\ but this is stuff I still don't understand well.


  • Sven Smiles

    Sven Smiles - 2010-06-10

    I tried that, thanks, or to be precise, in my code
       self.dirBrowseRoot.changeCallBack = self.dirBrowseRootChangeCallback
    but the callback isn't called.

    I'll fall back on editing out the line
                  changeCallback = self.dirBrowseRootChangeCallback)
    every time I want to run the frame editor.


Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

No, thanks