Tkinter Combobox Get current option
In the previous process of building Combobox there is textvariable=var, you can use var.get( ) to get the current option content.
Example#1
Add Print button to print options in the Python Shell window when this button is clicked.
from tkinter import *
from tkinter.ttk import *
def printSelection(): # Print the results of the selection
print(var.get())
root = Tk()
root.title("apidemos.com")
root.geometry("300x120")
var = StringVar()
cb = Combobox(root,textvariable=var) # Create Combobox
cb["value"] = ("Python","Java","C#","C","C++") # Set options
cb.current(0)
cb.pack(pady=10)
btn = Button(root,text="Print",command=printSelection) # Create Button
btn.pack(pady=10,anchor=S,side=BOTTOM)
root.mainloop()
Output: