ttk.Combobox - text field with popdown selection list
SYNOPSIS
instance = ttk.Combobox(master [,**options])
DESCRIPTION
A ttk.Combobox combines a text field with a pop-down list of values; the user may select the value of the text field from among the values in the list.
STANDARD OPTIONS
class
cursor
style
takefocus
cursor
style
takefocus
WIDGET-SPECIFIC OPTIONS
exportselection
Boolean value. If set, the widget selection is linked to the X selection.
Boolean value. If set, the widget selection is linked to the X selection.
justify
Specifies how the text is aligned within the widget. Must be one of "left", "center", or "right".
Specifies how the text is aligned within the widget. Must be one of "left", "center", or "right".
height
Specifies the height of the pop-down listbox, in rows.
Specifies the height of the pop-down listbox, in rows.
postcommand
A Python callback to evaluate immediately before displaying the listbox. The postcommand callback may specify the values to display.
A Python callback to evaluate immediately before displaying the listbox. The postcommand callback may specify the 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 select one 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.
One of "normal", "readonly", or "disabled". In the "readonly" state, the value may not be edited directly, and the user can only select one 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 the instance of a Variable class whose value is linked to the widget value. Whenever the instance changes value the widget value is updated, and vice versa.
Specifies the instance of a Variable class whose value is linked to the widget value. Whenever the instance changes value the widget value is updated, and vice versa.
values
Specifies the list of values to display in the drop-down listbox.
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.
Specifies an integer value indicating the desired width of the entry window, in average-size characters of the widget's font.
WIDGET COMMAND
The following methods are possible for Combobox widgets:
instance.current([newindex])
If newindex is supplied, sets the combobox value to the element at position newindex in the list of values. Otherwise, returns the index of the current value in the list of values or -1 if the current value does not appear in the list.
If newindex is supplied, sets the combobox value to the element at position newindex in the list of values. Otherwise, returns the index of the current value in the list of values or -1 if the current value does not appear in the list.
instance.get()
Returns the current value of the combobox.
Returns the current value of the combobox.
instance.set(value)
Sets the value of the combobox to value.
Sets the value of the combobox to value.
The Combobox widget also supports the following ttk.Entry widget methods (see ttk.Entry() for
details):
- bbox()
- delete()
- icursor()
- index()
- insert()
- selection()
- xview()
The Combobox widget also supports the following generic ttk.Widget widget methods (see ttk.Widget() for details):
- cget()
- configure()
- identify()
- instate()
- state()
VIRTUAL EVENTS
The Combobox widget generates a <<ComboboxSelected>> virtual event when the user selects an element from the list of values. If the selection action unposts the listbox, this event is delivered after the listbox is
unposted.
Comments
Post a Comment