Change keyboard layout with python?

孤街浪徒 提交于 2019-12-31 03:15:09

问题


I'm working on a college system (windows XP) and want to set the keyboard to Dvorak when I log on. I currently have a python script that changes the desktop image.

Can I use python to change the layout as well? Or are there other ways?


回答1:


to Change keyboard layout

import win32api
win32api.LoadKeyboardLayout('00000409',1) # to switch to english
win32api.LoadKeyboardLayout('00000401',1) # to switch to arabic

and for Dvorak :

win32api.LoadKeyboardLayout("00010409",1)

or

win32api.LoadKeyboardLayout("00020409",1)



回答2:


answer can be found at Programmatically change keyboard to Dvorak




回答3:


I would use AutoHotKey to change the layout. You could write a script remapping the keys and compile it as an executable file.

For example

q::'
+q::"
w::,
+w::<
e::.
+e::>
r::p

etc.



来源:https://stackoverflow.com/questions/1420925/change-keyboard-layout-with-python

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