GUI : tkinter
Default Way ....
import tkinter as tk
from tkinter import ttk
app = tk.Tk()
app.geometry('200x100')
labelTop = tk.Label(app,
text = "Choose your favourite month")
labelTop.grid(column=0, row=0)
comboExample = ttk.Combobox(app,
values=[
"January",
"February",
"March",
"April"])
pprint(dict(comboExample))
comboExample.grid(column=0, row=1)
comboExample.current(1)
print(comboExample.current(), comboExample.get())
app.mainloop()
Expected ....
import tkinter as tk
from tkinter import ttk
app = tk.Tk()
app.geometry('200x100')
labelTop = tk.Label(app,
text = "Choose your favourite month")
labelTop.grid(column=0, row=0)
comboExample = ttk.Combobox(app,
values=[(1,"January"),(2,"February"),(3,"March"),(4,"April")])
pprint(dict(comboExample))
comboExample.grid(column=0, row=1)
comboExample.current(1)
print(comboExample.current(), comboExample.get())
app.mainloop()
Question
In C# we use Value Member and Display Member
we Set 1, 2 ... as Value Member
Set January, .... as Display Member
When the application run shows January , .... but when we change the select index we can get value Member easily
So how can we same that in python using tkinter