Control the mouse and keyboard Golang?

浪子不回头ぞ 提交于 2019-12-10 02:30:39

问题


How would one go about controlling retrieving/setting the position of the mouse and triggier keyboard events on the operating system/X11 level? This is similar to functionality found in the Robot class in Java.

I understand there will most likely not be a cross platform solution, but how would one go about implementing this on Windows, Linux and Mac?


回答1:


Please see robotgo, Golang Native cross-platform system automation




回答2:


There are lots of ways to tackle this.

The project that appears closest to what you describe is "ui"

The next level up would be to use one of the go bindings that calls SDL, which might be easier.

Higher up the stack would be a toolkit like GTK, QT, FLTK, (or even X11 as BurntSushi5 mentioned, but I wouldn't recommend it.) Just search github for the toolkit and select by language.




回答3:


ncurses bind - is the most lightweight solution I've found, all the others are parts of graphic or gaming engines



来源:https://stackoverflow.com/questions/26446184/control-the-mouse-and-keyboard-golang

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