combobox(*args):

def show_data_2(*args):
print("Event: ComboboxSelected")
print(cbx_2.get())

Define tkinter data type

data2 = ["a2","b2","c2","d2","e2"]

Create a combobox, and tighter it to value

cbx_2 = ttk.Combobox(win, width = 12, height = 8)
cbx_2.grid(column = 0, row = 5)

set cbx_2 as readonly

cbx_2.configure(state = "readonly")

add data to combobox

cbx_2["values"] = data2

set the initial data [index =2] to shows up when win generated

cbx_2.current(2)

bind a event

cbx_2.bind("<>", show_data_2)

你可能感兴趣的:(combobox(*args):)