I want to create a customized dialog like Excel filter fucntion.
when search bar change then below checklistbox will update, and checklistbox can be multiple selection.
And now I have create a dialog, expected when wx.SearchCtrl change, then update below checklistbox, but I can't found how to do that.
Please give me a hand.
class MyFrame1 (wx.Dialog):
def __init__(self, parent):
wx.Dialog.__init__(self, parent, -1)
lst = ['apple','box','cat','dog','eye']
sizer = wx.BoxSizer(wx.VERTICAL)
self.search = wx.SearchCtrl( self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, 0 )
self.message = wx.StaticText(self, -1, "Pick some fruit")
self.clb = wx.CheckListBox(self, -1, choices = lst)
self.chbox = wx.CheckBox(self, -1, 'Select all')
self.btns = self.CreateSeparatedButtonSizer(wx.OK | wx.CANCEL)
self.Bind(wx.EVT_CHECKBOX, self.EvtChBox, self.chbox)
sizer.Add(self.message, 0, wx.ALL | wx.EXPAND, 5)
sizer.Add(self.search, 0, wx.ALL|wx.EXPAND, 5 )
sizer.Add(self.clb, 1, wx.ALL | wx.EXPAND, 5)
sizer.Add(self.chbox, 0, wx.ALL | wx.EXPAND, 5)
sizer.Add(self.btns, 0, wx.ALL | wx.EXPAND, 5)
self.SetSizer(sizer)
def EvtChBox(self, event):
state = self.chbox.IsChecked()
for i in range(self.clb.GetCount()):
self.clb.Check(i, state)
def OnExit(self, event):
self.Close()
if __name__ == '__main__':
app = wx.App()
frm = MyFrame1(None)
frm.Show()
app.MainLoop()