The ttk.Combobox widget combines a text field with a pop-down list of values. This widget is a subclass of Entry.
Besides the methods inherited from Widget: Widget.cget(), Widget.configure(), Widget.identify(), Widget.instate() and Widget.state(), and the following inherited from Entry: Entry.bbox(), Entry.delete(), Entry.icursor(), Entry.index(), Entry.insert(), Entry.selection(), Entry.xview(), it has some other methods, described at ttk.Combobox.

Options

This widget accepts the following specific options:

Option Description
exportselection Boolean value. If set, the widget selection is linked to the Window Manager selection (which can be returned by invoking Misc.selection_get, for example).
justify Specifies how the text is aligned within the widget. One of “left”, “center”, or “right”.
height Specifies the height of the pop-down listbox, in rows.
postcommand A script (possibly registered with Misc.register) that is called immediately before displaying the values. It may specify which values to display.
state One of “normal”, “readonly”, or “disabled”. In the “readonly” state, the value may not be edited directly, and the user can only selection of the values from the dropdown list. In the “normal” state, the text field is directly editable. In the “disabled” state, no interaction is possible.
textvariable Specifies a name whose value is linked to the widget value. Whenever the value associated with that name changes, the widget value is updated, and vice versa. See tkinter.StringVar.
values Specifies the list of values to display in the drop-down listbox.
width Specifies an integer value indicating the desired width of the entry window, in average-size characters of the widget’s font.

Virtual events

The combobox widgets generates a <> virtual event when the user selects an element from the list of values.

ttk.Combobox

class tkinter.ttk.``Combobox``current(newindex=None)
If newindex is specified, sets the combobox value to the element position newindex. Otherwise, returns the index of the current value or -1 if the current value is not in the values list.
get()
Returns the current value of the combobox.
set(value)
Sets the value of the combobox to value.