Filtered dropdown[choice] not working in wxpython version 4.1.1

How ever my filter dropdown example working in wxpython version 4.0.7 and not in latest 4.1.1 . the problem is while assign the value to combobox event get fired and then code goes in infinite loop and closes the application. here is my sample code.

import wx

class Mywin(wx.Frame):
def init(self, parent: object, title: object) -> object:
super(Mywin, self).init(parent, title=title, size=(300, 200))
self.languages = [‘C’, ‘C++’, ‘Python’, ‘Java’, ‘Perl’]

    panel = wx.Panel(self)
    box = wx.BoxSizer(wx.VERTICAL)

    self.label = wx.StaticText(panel, label="Your choice:", style=wx.ALIGN_CENTRE)
    box.Add(self.label, 0, wx.EXPAND | wx.ALL, 20)

    cblbl = wx.StaticText(panel, label="Combo box", style=wx.ALIGN_CENTRE)
    box.Add(cblbl, 0, wx.EXPAND | wx.ALL, 5)

    self.combo = wx.ComboBox(panel, choices=self.languages)
    box.Add(self.combo, 1, wx.EXPAND | wx.ALL, 5)

    box.AddStretchSpacer()
    self.combo.Bind(wx.EVT_TEXT, self.oncombo)
    self.ignoreEvtText = False

    panel.SetSizer(box)
    self.Centre()
    self.Show()

def oncombo(self, event):

    if self.ignoreEvtText:
        self.ignoreEvtText = False
        return

    textEntered = event.GetString()

    self.label.SetLabel("You selected" + self.combo.GetValue() + " from Combobox" + textEntered)

    if textEntered:
        self.ignoreEvtText = True
        matching = [s for s in self.languages if textEntered in s]
        self.combo.Set(matching)
        self.combo.SetInsertionPoint(len(textEntered))
        self.combo.SetValue(textEntered)
    else:
        self.combo.Set(self.languages)

    self.combo.Popup()

app = wx.App()
Mywin(None, ‘ComboBox and Choice demo’)
app.MainLoop()

Hi, sudarshankapse

The answer is here wx.TextCtrl — wxPython Phoenix 4.1.2a1 documentation.
Wx.ComboBox is a subclass of wx.TextEntry as well as wx.TextCtrl. SetValue triggers EVT_TEXT event, so it calls the same handler recursively.
Normally, EVT_COMBOBOX is used to detect that the selection has changed.

Thank you for reply, Yes, understood your point but If I uses EVT_DROPDOWN then functionality won’t work as per my condition. Basically I have to auto popup list on entered text. Is there any thing around that.

Maybe wx.EVT_TEXT_ENTER is what you need to capture. (see wx.ComboBox — wxPython Phoenix 4.1.2a1 documentation)

        self.combo.Bind(wx.EVT_TEXT_ENTER,
                        lambda v:self.combo.Popup())

Don’t forget to create the object with the style specifying,

        self.combo = wx.ComboBox(self, style=wx.TE_PROCESS_ENTER, .... )