Tkinter OptionMenu to show dropdown list box with options from List and dictionary values to users

preview_player
Показать описание

OptionMenu provides options to the user to select one from the available list. It is also known as dropdown list box.
We can display a list of options to the user for their selection. The options can be given by directly writing as the options while declaring the optionmenu.
om1=tk.OptionMenu(my_w,options,'HTML','PHP','Phthon')
We can use one list for storing the options as elements and unpack the same list to display the optionmenu.
my_list=['Php','MySQL','Python','HTML']
options=tk.StringVar(my_w)
l1=tk.Label(my_w,text="Select One")

om1=tk.OptionMenu(my_w,options,*my_list)
While assigning the elements we have unpacked the list.
We can use one dictionary values also as options of the option menu.
my_dict1={1:'Fruits',2:'Colours',3:'Games',4:'Vehicles'}
options=tk.StringVar(my_w)
l1=tk.Label(my_w,text="Select One")

Рекомендации по теме
Комментарии
Автор

I want to jump on word by click letter on keyboard if I have 100 options

PANDURANG