Thank you so much for another excellent tutorial. Sadly I can't get my the bind bit working.. The window and selectable window are fine, but when a selection was made nothing new happens. I've tried in Thonny and pycharm. Any advice? - UPDATE: The error below was that I should have written ComboboxSelected (!!), not ComboboxSelectiobn. Tq.. def RunMyUserFn(event): my_Label = Label(root, text=sel.get()).pack() # label doesn't appear in the window print("An event was noted") # no console output occurs. cb1.bind("", RunMyUserFn) sel = tk.StringVar() # 'sel' is a variable to hold the option clicked on sel.set(MPA_list[0]) # set first element in list as default combobox display cb1 = ttk.Combobox(root, values=MPA_list, width=15, textvariable=sel) cb1.bind("", RunMyUserFn)
Пікірлер: 8