6

Does TkInter unbind function prevents the widget on which it is applied from binding further events to the widget ?

Clarification:

Let's say I bound events to a canvas earlier in a prgram:

 canvas.bind("<Button-1>",some_function)

Then at a certain point of the program, we no longer need those events:

 canvas.unbind("<Button-1>")

Can we later do something like this:

 canvas.bind("<Button-1>",OTHER_function)
  • My bad, I misread the question. Of course, this can be done. After unbinding a function from an event, you can then bind a function to the event. – Malik Brahimi May 12 '15 at 15:59
  • 1
    It would be better to provide a [minimal example](http://stackoverflow.com/help/mcve) of what you've tried and a clear description of the issue. – jonrsharpe May 12 '15 at 16:02
  • @jonrsharpe this question does not need an example given its nature. I am asking about the effect of a method that is not mine but offered by a library, so any one who had experience with it could answer. No need for code. –  May 12 '15 at 16:03
  • 2
    The question in its current form is pointless - the obvious answer is *"why don't you try it and see?"* But then you commented *"I have a real problem in binding an other event after unbinding"* - presumably you *have* tried it, but failed to make it work, so I would suggest skipping the interim steps and asking the question you actually want answering! – jonrsharpe May 12 '15 at 16:06

1 Answers1

9

No, unbinding an event doesn't prevent further bindings on the widget. You can bind an event, unbind it, and then bind it again at a later date as often as you want.

Bryan Oakley
  • 370,779
  • 53
  • 539
  • 685