英文:
Control the mouse and keyboard Golang?
问题
如何在操作系统/X11级别上控制鼠标的位置、触发键盘事件?这类似于Java中的Robot类的功能。
我理解可能没有跨平台的解决方案,但是在Windows、Linux和Mac上如何实现呢?
英文:
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
得分: 15
请查看 robotgo,这是一个用于 Golang 的原生跨平台系统自动化库。
英文:
Please see robotgo, Golang Native cross-platform system automation
答案2
得分: 2
有很多方法可以解决这个问题。
最接近你描述的项目是"ui"。
更高级的方法是使用调用SDL的Go绑定库,这可能更容易一些。
再高级一点的方法是使用像GTK、QT、FLTK这样的工具包(或者像BurntSushi5提到的X11,但我不推荐这样做)。只需在GitHub上搜索相应的工具包,并按语言进行选择。
英文:
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
得分: 2
ncurses bind - 是我找到的最轻量级的解决方案,其他的都是图形或游戏引擎的一部分。
英文:
ncurses bind - is the most lightweight solution I've found, all the others are parts of graphic or gaming engines
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论