ComboBox.SetItems triggers EVT_TEXT

Is ComboBox.SetItems supposed to trigger the EVT_TEXT event? I am on Windows 10, Python 3.7 wxPython 4.1.0. There is no documentation on this method in the docs so I don’t know if this is intended behaviour or a bug. If it is intended is there a way to update the items without triggering EVT_TEXT?

Generally, making changes to a widget programmatically is not supposed to cause events to be sent, but EVT_TEXT is an exception to the rule, due to various historical reasons. An easy workaround is to set a flag before calling SetItems and checking for the flag in the event handler and just return immediately if it’s set.

BTW, SetItems is actually a compatibility alias for the Set method. (I guess it should probably be deprecated to make that more clear…)

Thanks for the response. This works but is a little bit of a workaround. Would be nice if there was an alternative way that didn’t generate the events