3 of 5
added 57 characters in body

How to get Int value from spinbox to create new entries

  • I created a simple spin box. what I want is, as I increase or decrease the value in spin box, a new entry should be created or deleted respectively.
  • I am not able to get the Int value from the spinbox.
  • I tried, user_input = int(sb.get()), But this also didn't work.
  • I am getting this error, 'str' object cannot be interpreted as an integer.

,,,

from tkinter import *
root = Tk()

sb_var = IntVar()
sb = Spinbox(root, bg='gray', textvariable=sb_var)
sb.pack()
user_input = sb.get()

for x in range(user_input):
    my_entry = Entry(root)
    my_entry.pack()

root.mainloop()

,,,