469,903 Members | 1,807 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,903 developers. It's quick & easy.

Re: How to delete elements from Tix Combo Box?

On Sat, Aug 30, 2008 at 2:32 PM, Fredrik Lundh <fr*****@pythonware.comwrote:
du**********@gmail.com 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

</F>

--
http://mail.python.org/mailman/listinfo/python-list
Fredrik, Thanks so much. That worked.

Following this, I can now see that my combo2 has no previous elements
and contains only the elements relevant to selection in combo1.

Now, as soon as I select something in combo 2 and go back to change
selection in combo1 the combo2 must get its history cleared up (i.e
the previous selection in combo2's entry subwidget)

I used the command before I delete the entires :
self.combo2.config(history = False)

But this does not seem to be working;

Here is my code snippet:
****************
Inside the callback function of combo1:

for libName, libResults in self.__libVerDict.items():
if libName == selectedLibName:
#Get the list of labelled results
resultsVer = self.__libVerDict[libName]
self.combo2.config(state = NORMAL)
self.combo2.config(history = False)
#Delete the previous entries from the listbox
#subwidget of combo box
subLB = self.combo2.subwidget("listbox")
subLB.delete(0, END)
#Add the results to the combo box
for results in resultsVer:
self.combo2.insert(END, results)
--
Regards,
Rajat
Aug 30 '08 #1
0 1375

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

14 posts views Thread by Timothy Madden | last post: by
reply views Thread by Tony Williams | last post: by
4 posts views Thread by Chuckles | last post: by
reply views Thread by dudeja.rajat | last post: by
reply views Thread by Fredrik Lundh | last post: by
1 post views Thread by Waqarahmed | last post: by
reply views Thread by Salome Sato | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.