How to delete elements from Tix Combo Box?

Fredrik Lundh fredrik at
Sat Aug 30 15:32:06 CEST 2008

dudeja.rajat at wrote:

> I'm using a Tix combo box (I call it combo2), the contents of which
> are loaded depeding on the selection in another Tix combo box(I call
> it combo1)
> I have used the commands:
> self.cbAnalysisLibVersion.insert(END, results)
> to insert elements to the combo box.
> I'm looking for some similar option to delete elements from the combo
> box. I mean, as soon as I change selection in
> combo1 the previous elements in the combo2 should get cleared up( or
> deleted) and | shall be able to the above insert command to add new
> elements to the combo2 ( depending upon selection in combo1)
> Please suggest how can I clear up the ( delete the entries) in combo2.

no time to test this, but iirc, the combobox content is held in an 
ordinary listbox widget, so you should be able to use the subwidget 
method to fetch that widget, and then use ordinary listbox methods to 
change the content.  Something like this:

     lb = w.subwidget("listbox")
     lb.delete(0, END) # delete all items


More information about the Python-list mailing list