TkInter: understanding unbind function

我与影子孤独终老i 提交于 2021-02-08 05:43:21

问题


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)

回答1:


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.



来源:https://stackoverflow.com/questions/30195729/tkinter-understanding-unbind-function

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!