In wxPython, I'm using wxTreeCtrl. I've setup a EVT_TREE_KEY_DOWN handler as
such:
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?
The output from pressing the delete key is:
in here <type 'instance'> wxPython.controls2.wxTreeEventPtr {'this':
'_bfffe6f0_wxTreeEvent_p', 'thisown': 0}
<C wxTreeItemId instance at _848d998_wxTreeItemId_p> None ''
Thanks lots,
Dave
···
__________________________________________________
Do You Yahoo!?
Sign up for SBC Yahoo! Dial - First Month Free
http://sbc.yahoo.com