python Tix - how to clear a combobox -
how clear items in tix.combobox object? tried things
cb.entry.delete (0, tix.end) and other veriations of function doesn't seem anything. not clear api function should use , doc i've read nothing it. possible??
thanks!
edit: ps deleting item name great. couldn't find how either.
as the docs say, combobox has entry subwidget, , listbox subwidget. see the wikipedia page on combo boxes in general: something else part entry, , list item 1 etc. parts listbox.
so, cb.entry.delete valid, it's deleting contents of entry subwidget. doesn't affect of items in listbox.
so, how listbox? well, in tcl/tk, can access cb.listbox. doesn't work in python/tkinter.
if @ the source, can see combobox doesn't have 2 sub-widgets, five, none of listbox or named listbox:
entry entry arrow button slistbox scrolledlistbox tick button cross button : present if created fancy option (you should able see help(tix.combobox) in interactive interpreter.)
but scrolledlistbox another tix composite widget, without useful on own, still need find listbox sub-sub-widget. @ or source , it'll show scrolledlistbox has listbox. fortunately, is listbox (well, _dummylistbox, that's listbox subclass knows how tix subwidget).
so, really want cb.slistbox.listbox.
(i believe tcl/tk forwards along attribute references, while python/tkinter doesn't, why tix , other fancy tk wrappers , extensions aren't nice use python tk docs make them appear.)
note that, docs listbox say, 0 refers first entry, , end last entry, arguments in call correct.
so, long story short, should it:
cb.slistbox.listbox.delete(0, tix.end) and should know how find similar cases in future. (assuming you're not traumatized tix avoid completely.)
meanwhile, far know, there's no way delete name, it's not hard yourself. iterate entries , check them:
for in range(cb.slistbox.listbox.size()): if cb.slistbox.listbox.get(i) == name: cb.slistbox.listbox.delete(i) break
Comments
Post a Comment