0

How can I go to the clickbox event on the listbox with a parameter?

listabook.bind('<Button-1>',Delete(labelvoto))

def Delete(label):
    label.destroy()
Vincenzo
  • 25
  • 4
  • Hi Vinzenzo. I had to play around with the code a little. My initial thought on using lambda were not fully accurate. I have fixed my code. Let me know if it helps. – Mike - SMT May 12 '17 at 20:34
  • You should have enough points now to start up voting answers on your questions. Consider looking over your past questions and up voting answers you found helpful. This will help other find the answers they need down the road. – Mike - SMT May 12 '17 at 20:46

1 Answers1

0

You may have to use lambda here. When you are creating your listabook bind then If you have something that is going to call the function before it has been initialized then you need to make sure your function precedes that call in the code.

There is some good information on lambda here.

The below should work.

def Delete(label):
    label.destroy()

listabook.bind('<Button-1>',lambda _: Delete(labelvoto))
Mike - SMT
  • 14,784
  • 4
  • 35
  • 79