Tkinter Spinbox get method
You can use the get() method to get the current Spinbox value.
Tkinter Spinbox get method Example#1
Design the value range from 0 to 10, change the value 1 each time, and each time you click the up/down button, you can list the currently displayed value in the Python Shell window.
from tkinter import *
def printInfo(): # Print the displayed value
print(sp.get())
root = Tk()
root.title("apidemos.com")
sp = Spinbox(root,from_=0,to=10,command=printInfo)
sp.pack(pady=10,padx=10)
root.mainloop()
Output:
The following is the sample output displayed in the Python Shell window: