Hello All
I feel like I'm missing something dumb here. I have code below to pick from a drop down list (combobox). There is some naming problem with my code. My expectation would be the combobox options would be "Trump", "Obama", and "Bush". Instead I get "dict_keys(['Trump'," , "'Obama'," , and "'Bush'])"
Does anyone know adjustment I can make to get the values I am looking for?
I feel like I'm missing something dumb here. I have code below to pick from a drop down list (combobox). There is some naming problem with my code. My expectation would be the combobox options would be "Trump", "Obama", and "Bush". Instead I get "dict_keys(['Trump'," , "'Obama'," , and "'Bush'])"
Does anyone know adjustment I can make to get the values I am looking for?
presidents = {'Trump' : {2020,2019,2018,2017} , 'Obama' : {2016,2015,2014,2013,2012,2011,2010,2009} , 'Bush' : {2008,2007,2006,2005,2004,2003,2002,2001}} import tkinter as tk from tkinter import ttk app = tk.Tk() app.title('President') app.geometry('500x300') def function(): print(combobox.get()) label = tk.Label(app, text = "Who is your favorite president?") label.grid(column=0, row=0) combovalues = presidents.keys() combobox = ttk.Combobox(app, values=combovalues) combobox.grid(column=5, row=0) resultButton = tk.Button(app, text = 'Confirm', command=function) resultButton.place(x=15,y=45)