String with integer in spinbox values

You can remove some repetition by getting rid of xinput_values and passing the keys of xinput_code to the spinbox like this:

xinput = tk.Spinbox(root, values=list(xinput_code), width=10, relief="sunken", repeatdelay=500, repeatinterval=100,
                     font=("Arial", 12), bg="lightgrey", fg="blue", command=xinput_change)

The advantage is that you won’t need to also update xinput_values if you ever modify xinput_code.