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()
2
  • 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. Commented May 12, 2017 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. Commented May 12, 2017 at 20:46

1 Answer 1

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))
Sign up to request clarification or add additional context in comments.

1 Comment

i have done with lambda event: Thanks

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.