firstlabel_label3 = ttk.Label(firstlabel, text ="콤보1: ") # 콤보박스 추가
firstlabel_label3.grid(column=0, row=2)

label2_combo = tk.StringVar() #레이블1의 텍스트 입력 박스2
label2_combo = ttk.Combobox(firstlabel, width=30, textvariable=label2_combo)
label2_combo['values'] = ('option1','option2', 'option3','option4')
label2_combo.current(0)
label2_combo.grid(column=1, row=2)
label2_combo.configure(state='readonly')  #콤보박스의 텍스트를 편집 불가능하게 읽기 전용으로 하는 것이다

 

def Excute:

print ( label2_combo.get())  # def 콜백함수와 쓰는경우, 콤보박스의 데이터 출력이 가능

+ Recent posts