#coding=utf-8
from tkinter import *
root=Tk()
def callback(event):
    print("点击键盘",repr(event.char))
frame=Frame(root,width=200,height=200)
frame.bind("<Key>",callback)
frame.focus_set()
frame.pack()
mainloop()

效果图:

python  监听键盘事件

 

相关文章:

  • 2021-09-03
  • 2021-10-18
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2022-02-02
  • 2022-12-23
  • 2022-12-23
  • 2021-12-09
  • 2021-08-29
  • 2021-10-30
相关资源
相似解决方案