Hi everyone :)

Title says it all... I'm trying to bind events to a wx.GenericDirCtrl.

I've visited more than 20 web sites but i haven't found how to do it. I've tried different manners but it doesn't work as i expect it to.
In some case my control is seen as a normal TreeCtrl and i can't use with it the GetFilePath method of the GenericDirCtrl (
), in other case i can't get all the path of the selected file and folder in the tree, GetFilePath gives just the name...

Help me please to make it do its job!

Here is my code:

#The tree
filesNav = wx.GenericDirCtrl(self.nBpane2, 210, dir=hp, pos=wx.DefaultPosition, size=wx.DefaultSize, filter="Fichier PHP (*.php)|*.php", style=0)

#Biding event
filesNav.Bind(wx.EVT_TREE_SEL_CHANGED, self.OnSel)

### A method
def OnSel(self, event):
    item = event.GetFilePath()
    print item

### Error:
# Traceback (most recent call last):
# File "./Main.py", line 419, in OnSel
#   item = event.GetFilePath()
# AttributeError: 'TreeEvent' object has no attribute 'GetFilePath'

Thanks a lot!

Edited by stefh: Orthograph (i'm french)

5 Years
Discussion Span
Last Post by stefh

Thanks a lot pyTony! Solved...

def OnSel(self, event):
    item = filesNav.GetFilePath()
    print item
This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.