#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()
效果图:
社区微信群开通啦,扫一扫抢先加入社区官方微信群
社区微信群
#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()
效果图:
转载于:https://www.cnblogs.com/sea-stream/p/10989679.html
如果觉得我的文章对您有用,请随意打赏。你的支持将鼓励我继续创作!