Table of Contents
Contains the GComboBox widget. A Combobox style widget is not commonly available within the Tkinter library.
Below is an example of using the GComboBox widget.
This will create a dialog that contains a GComboBox widget with 100 items in it and with item 30 selected.
Example of the GComboBox widget.
Creates our own custom combobox.
All other keywords can be applied to the GComboBox object's components by prefixing the keyword with the component name.
Some additional information about the cget() and configure() options,
The keyword text will return the a string of the currently selected item in the combobox.
To find the index of the currently selected item do the following, with a combobox named cb,
index = cb.find(cb.cget('text'))
if index is None:
print "no item selected"
else:
print "index of selected item is: %d" % (index)To change the color configuration, use the entry_XXX keywords. For example, entry_enablebackground and entry_disablebackground. In the future these will be mapped to the combobox proper, but for now prefix with entry.
Removes the said items from the combobox list
Note
If you attempt to delete everything from a combobox that has a required flag on it, then your dialog will go into an inconsistent state. If you have a required flag set, then perfer to clear you combobox and incrementally insert.
Inserts a list of items into the pulldown box.
Some examples are,
combobox.insert(Tkinter.END, 'copper', 'gold', 'silver')
items = ["MODEL1", "MODEL2", "MODEL3"]
combobox.insert(Tkinter.END, *items)
Both these examples insert items into the end of the combobox.
Clears the text entry box.
Raises GWidgetError for a clear request made to a combobox that requires an entry.
Ensure that the entry and RTV are in sync.
In this case forwards to internal entry widget.