我正在制作一个程序,当我按下自己的快捷键(ctrl+q)时,它将执行多个键盘操作。当程序处于后台时,如何使程序侦听绑定
def pasteFun(event):
messagebox.showinfo("hey")
root.bind("<Control-q>", pasteFun)
当我在程序中时,这很好,但是当我最小化它时,ctrl+q什么也不做
def test(event):
messagebox.showinfo("hey","hey")
root.bind_all("<Control-q>",test)
我已经尝试了root.bind、frame.bind和root.bind_,但是当程序在后台/最小化时,我的绑定什么都不做
我需要一个函数来运行,当我在程序之外并点击我的绑定/快捷键时
你不能用tkinter那样做。Tkinter只有在有焦点时才会看到事件。这是其设计的基本部分
相关问题 更多 >
编程相关推荐