Answers for "how to create a dropdown menu in tkinter"

-1

how to make a drop down box tkinter

from tkinter import *
from tkinter import ttk

screen = Tk()

my_weekdays_names = ["MONDAY","TUESDAY","WENSDAY","THURSDAY","FRIDAY","SATURDAY","SUNDAY"]

def weekdaySelection(event):
   for x in range(7):
      if weekdaysDropdown.get() == my_weekdays_names[x]:
         print(my_weekdays_names[x])
          
          
weekdaysDropdown = ttk.Combobox(screen, values = my_weekdays_names)
weekdaysDropdown.current(1)
weekdaysDropdown.bind("<<ComboboxSelected>>", weekdaySelection)
weekdaysDropdown.grid()
Posted by: Guest on February-07-2021

Code answers related to "how to create a dropdown menu in tkinter"

Python Answers by Framework

Browse Popular Code Answers by Language