Listbox.. ACTIVE-item is the one selected previously..

Andrew Markebo andrew.markebo at telelogic.se
Sun Oct 31 17:04:21 EST 1999


What have I now missed?? 

I want to have a listbox, and when the user clicks on one item in it,
he gets the value selected 'published' somewhere.. with the small
program included below.. If it is launched, and the user selects the
letters in order I would assume the result to be "abcde", but what I get is:
"aabcd", after the first selection, ACTIVE is lagged.. 

What have I missed?? (or am I just in need of coffee or sleep?)

        /Andy

--------------------

z=None
def click(event=None):
   global z
   print z.get(ACTIVE)
   
def test():
   global z
   frame=Frame(None)
   frame.pack()
   z=Listbox(frame)
   z.pack()
   z.bind("<Button-1>", click)
   for i in ("a", "b", "c", "d", "e"):
      z.insert(END, i)

   frame.mainloop()

test()





More information about the Python-list mailing list