暂停所有绑定TKINTER
是否有可能暂停 tkinter上的所有绑定?例如:
from tkinter import *
root = Tk()
root.geometry("600x400")
def function(event=None):
print("Hello world!")
btn = Button(root,text="Click me!")
btn.bind("<Button-1>",function)
btn.pack()
def resume_bindings():
pass
def pause_bindings():
pass
root.mainloop()
一种方法可以是调用 btn.bind 方法 resume_bindings ,但我正在寻找与中断更相似的东西。在Arduino中,您可以通过以下内容激活/脱离所有中断:
interrupts();
noInterrupts();
是否有一种方法可以暂停/暂时性地脱离TKINTER中的所有绑定?谢谢!
Is there any possibility to pause all bindings on tkinter?? For instance:
from tkinter import *
root = Tk()
root.geometry("600x400")
def function(event=None):
print("Hello world!")
btn = Button(root,text="Click me!")
btn.bind("<Button-1>",function)
btn.pack()
def resume_bindings():
pass
def pause_bindings():
pass
root.mainloop()
A way could be to call the btn.bind method inside resume_bindings, but I was looking for something more similar to interruptions. In Arduino, you can activate/desactivate all interruptions with the following:
interrupts();
noInterrupts();
Is there a method to pause/temporally desactivate all bindings in tkinter? Thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
有一种方法可以通过设置小部件的状态来暂停/暂时性地启用所有绑定。
按钮状态
There is a method to pause/temporally desactivate all bindings in tkinter, works by setting the state of the widgets.
Button State