Try the following solution:
def evt_selected(self, event):
wx.CallAfter(self.selectIt, event.m_itemIndex)
def selectIt(self, new_select):
if self.cur_select is not None and new_select != self.cur_select:
dlg = wx.MessageDialog(self,
'Allow selection to change?',
'Some Dialog',
wx.YES|wx.NO|wx.CENTRE|wx.ICON_WARNING)
answer = dlg.ShowModal()
if answer == wx.ID_NO:
self.list_ctrl_1.SetItemState(new_select,
0,
wx.LIST_STATE_FOCUSED|wx.LIST_STATE_SELECTED,
)
self.list_ctrl_1.SetItemState(self.cur_select,
wx.LIST_STATE_FOCUSED|wx.LIST_STATE_SELECTED,
wx.LIST_STATE_FOCUSED|wx.LIST_STATE_SELECTED,
)
return
self.cur_select = new_select
self.list_ctrl_1.Focus(new_select)