Dynamically change the choices in a wx.ComboBox()

前端 未结 1 885
别那么骄傲
别那么骄傲 2021-02-07 05:43

I didn\'t find a better way to change the different choices in a wx.ComboBox() than swap the old ComboBox with a new one. Is there a better way?

Oerjan Pettersen

相关标签:
1条回答
  • 2021-02-07 06:19

    wx.ComboBox derives from wx.ItemContainer, which has methods for Appending, Clearing, Inserting and Deleting items, all of these methods are available on wx.ComboBox.

    One way to do what you want would be to define the text_return() method as follows:

    def text_return(self, event):
        self.st.Clear()
        self.st.Append('3')
        self.st.Append('4')
    
    0 讨论(0)
提交回复
热议问题