Spinbox – a very short, very colorful demo. Its a shame you can’t really spin the spinner. Wish there was a way to make the spinner aparatus larger.
#TEST AREA for Spinbox
#standard set up header code 2
from tkinter import *
root = Tk()
root.attributes('-fullscreen', True)
root.configure(background='SteelBlue4')
scrW = root.winfo_screenwidth()
scrH = root.winfo_screenheight()
workwindow = str(1024) + "x" + str(768)+ "+" +str(int((scrW-1024)/2)) + "+" +str(int((scrH-768)/2))
top1 = Toplevel(root, bg="light blue")
top1.geometry(workwindow)
top1.title("Top 1 - Workwindow")
top1.attributes("-topmost", 1) # make sure top1 is on top to start
root.update() # but don't leave it locked in place
top1.attributes("-topmost", 0) # in case you use lower or lift
#exit button - note: uses grid
b3=Button(root, text="Egress", command=root.destroy)
b3.grid(row=0,column=0,ipadx=10, ipady=10, pady=5, padx=5, sticky = W+N)
#____________________________
sb1value=StringVar()
sb1value.set("green")
demofont="arial 14 bold"
sbtuple=('red','orange','yellow','green','blue','indigo','violet')
def sbaction():
sb1value.set(sb1.get())
l1.configure(bg=sb1.get())
if sb1.get()=='blue' or sb1.get()=="violet" or sb1.get()=="indigo":
l1.configure(fg="white")
else:
l1.configure(fg="black")
#sb1=Spinbox(top1, textvariable=sb1value, from_=1, to=10)
sb1=Spinbox(top1, textvariable=sb1value, values=sbtuple, width=20, wrap=True)
sb1.configure(activebackground="light blue",
bg="beige",
bd=10,
command=sbaction,
font=demofont,
buttonbackground="LightGoldenrod2",
fg="black",
justify="center",
repeatinterval=500,
width=2)
sb1.pack(padx=300, pady=200, ipadx=40, ipady=30)
l1=Label(top1,bg=sb1value.get(),textvariable=sb1value, font=demofont, relief=SUNKEN,bd=10)
l1.pack(padx=300, pady=5, ipadx=10, ipady=10, expand=True, fill='x')
#____________________________
root.mainloop()

