Tkinter determine keyboard layout

旧时模样 提交于 2019-12-13 04:27:04

问题


Is there a way to detect current keyboard layout in Tkinter?

It is necessary to process keyboard accelerators correctly for such languages as Russian, French, Greek (see my other question for details).


回答1:


No, there is no such feature built into Tkinter.

Why not simply have your application ask the user where each special key is, the first time the app starts up? Apple does this with OSX -- it asked me to press a couple of keys the very first time I booted up a fresh install.

You can put the focus into a widget and bind to <Any-KeyPress>, and from that grab enough information to bind to whatever key they pressed.



来源:https://stackoverflow.com/questions/14472766/tkinter-determine-keyboard-layout

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