Python How To Update Combobox Values While Writing?
I want to have a list of values that is updated when I edit the text on the upper text field of the ComboBox, but I have found no option to access the value of this text field. I c
Solution 1:
You can use the textvariable option of the combobox
.
import tkinter as tk
from tkinter import ttk
def update(*args):
newvalues=[i for i in a_set if var.get() in i]
lista['values']=newvalues
a_set=('one','two','three')
master = tk.Tk()
var = tk.StringVar()
var.trace('w', update)
lista = ttk.Combobox(master, width=22, textvariable=var)
lista.grid(row=0,column=0)
master.mainloop()
Post a Comment for "Python How To Update Combobox Values While Writing?"