【发布时间】:2014-08-15 17:01:48
【问题描述】:
我正在尝试编写脚本在 OSX 10.9 上隐藏鼠标光标。我有 Chrome 启动并全屏显示信息亭,我想定期运行一个脚本来隐藏光标。
Applescript 不再直接支持“调用方法”来调用目标 C 方法,所以我认为最简单的方法是使用提供的 python 中的 AppKit。
它崩溃了:
$ python
Python 2.7.5 (default, Mar 9 2014, 22:15:05)
[GCC 4.2.1 Compatible Apple LLVM 5.0 (clang-500.0.68)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import AppKit
>>> AppKit.NSCursor.hide()
Assertion failed: (CGAtomicGet(&is_initialized)), function CGSConnectionByID, file Services/Connection/CGSConnection.c, line 123.
Abort trap: 6
我怀疑我需要进行一个先决条件调用来初始化一些东西,但我在浏览 docs/google 时还没有找到任何东西。
我错过了什么?
【问题讨论】:
标签: python macos appkit pyobjc