Tkinter - what's the Index of selected value in spinbox?
<p>I've built a class for item selection with Tkinter Spinbox. I'd like to return the index of the selected item. Is that possible?</p>

<pre><code>from Tkinter import *

class TestSpin():
  def __init__(self, i_root, i_friendlist):
    self.root = i_root
    self.root.friend = Spinbox(self.root, values = i_friendlist)
    self.root.friend.pack()
    self.root.okbutton = Button(self.root, text='Ok', command = lambda: self.ack())
    self.root.okbutton.pack()

  def ack(self):

# here I'd like to have the index of selected item in friendlist
    print "Index of "+self.root.friend.get()+" is [0 or 1 or 2]:", self.root.friend 
# here I'd like to have the index of selected item in friendlist

    self.root.destroy()

root = Tk()
list = ['Emma','Sarah','James']
app = TestSpin(root, list)
root.mainloop()
</code></pre>

<p>Thanks a lot for your advice. I tried self.root.friend.index(), but that method wants an argument which I do not understand.</p>