python - 在 Mac OS X 中移动光标(在 Python 和/或 R 中)

标签 python macos r

谁能帮我弄清楚如何使用 Python 或 R 脚本在 Mac OS X 中移动光标?计划是读取实时信号并根据流值向上或向下移动光标。感谢您的帮助 ... 谢谢!

最佳答案

好吧,R 允许你使用 C,所以它听起来像作弊,但有效:

library(inline)
move.cursor <- cfunction(c(x="numeric",y="numeric"),
  "CGWarpMouseCursorPosition(CGPointMake(asReal(x),asReal(y)));
   return R_NilValue;",
  "#include <ApplicationServices/ApplicationServices.h>",,"C",
  libargs="-framework AppKit")

然后您只需调用move.cursor 即可移动光标:

move.cursor(100, 100)

关于python - 在 Mac OS X 中移动光标(在 Python 和/或 R 中),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12127150/

相关文章:

python - 生成每个索引具有单独限制的所有排列

python - 将值从解析传递到管道初始化

ios - 使用服务器证书签署 iPhone 配置文件

cocoa - 需要在非按键窗口接收滑动事件

swift - 将 NSTextField 对象连接到 AppDelegate.swift 中的 IBOutlet

r - 如何正确地从 R 内部转义系统调用

r - 向 ordiplot3d() 添加点

json - R中的可折叠树

python:将数据框更新到现有的Excel工作表而不覆盖同一张纸和其他工作表上的内容

python - 如何在 Python 中进行实时语音事件检测?