> In wxPython, I'm using wxTreeCtrl. I've setup a EVT_TREE_KEY_DOWN handler as
> EVT_TREE_KEY_DOWN( self, treeID, self.OnKeyDown )
> In OnKeyDown, I have:
> def OnKeyDown( self, event ):
> key = event.GetKeyEvent().GetKeyCode()
> if key == WXK_DELETE:
> print 'in here', type( event ), event.__class__, event.__dict__
> item_ctl = event.GetItem()
> item_ob = self.tree.GetPyData( item_ctl )
> item_txt = self.tree.GetItemText( item_ctl )
> print item_ctl, item_ob, "'" + item_txt + "'"
> But item_txt is always empty, and item_ob is always None, even though I'm on a
> good tree node when I press key. What might I be doing wrong here? Any ideas?
print item_ctl.IsOK() (or IsOk():^)
maybe you need self.tree.GetSelectedItem() instead.