Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > Re: How to delete elements from Tix Combo Box?

Reply
Thread Tools

Re: How to delete elements from Tix Combo Box?

 
 
dudeja.rajat@gmail.com
Guest
Posts: n/a
 
      08-30-2008
On Sat, Aug 30, 2008 at 2:32 PM, Fredrik Lundh <(E-Mail Removed)> wrote:
> http://www.velocityreviews.com/forums/(E-Mail Removed) 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
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: How include a large array? Edward A. Falk C Programming 1 04-04-2013 08:07 PM
How to delete elements from Tix Combo Box? dudeja.rajat@gmail.com Python 0 08-30-2008 01:23 PM
How to bind an event in Tix combo box? dudeja.rajat@gmail.com Python 0 08-26-2008 07:43 AM
windows / Tkinter - Tix - combo box - how to bind function to an event dudeja.rajat@gmail.com Python 0 08-25-2008 02:14 PM
Tkinter - How to create combo box using Tix with the existing Tkinterwidgets/ dudeja.rajat@gmail.com Python 0 08-25-2008 11:57 AM



Advertisments