python tk change combo menu

Solutions on MaxInterview for python tk change combo menu by the best coders in the world

showing results for - "python tk change combo menu"
Lara
28 Mar 2017
1 pythonCopyimport tkinter as tk
2from tkinter import ttk
3
4def callbackFunc(event):
5     print("New Element Selected")
6     
7app = tk.Tk() 
8app.geometry('200x100')
9
10def changeMonth():
11    comboExample["values"] = ["July",
12                              "August",
13                              "September",
14                              "October"
15                                ]
16
17labelTop = tk.Label(app,
18                    text = "Choose your favourite month")
19labelTop.grid(column=0, row=0)
20
21comboExample = ttk.Combobox(app, 
22                            values=[
23                                    "January", 
24                                    "February",
25                                    "March",
26                                    "April"],
27                            postcommand=changeMonth)
28
29
30comboExample.grid(column=0, row=1)
31
32app.mainloop()
similar questions
queries leading to this page
python tk change combo menu