Python 的 Gnome 屏幕保护程序?
我用 Python 创建了一个小屏幕保护程序类型的程序,我想让它在 gnome-screensaver 下正常工作。文档都是针对 C 语言编写的,似乎没有针对 Python 的库。有什么办法可以让它发挥作用吗?
I've created a little screensaver-type program with Python, and I'd like to get it working properly under gnome-screensaver. The documentation is all written for C, and there don't appear to be libraries for Python. Is there any way to get this working?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
gnome-screensaver 不与屏幕保护程序集成,就像与一个小配置文件集成一样,该配置文件设置名称、一些其他属性以及启动屏幕保护程序所需执行的命令。这在 gnome-screensaver FAQ 中有记录。
启动的程序需要从环境中获取窗口 ID (
XSCREENSAVER_WINDOW
),并开始在该窗口上显示。这是棘手的部分,因为如何做到这一点并不总是显而易见的。大多数工具包应该有方法通过提供 ID 来获取现有窗口的句柄,因此请在 GUI 工具包文档中搜索类似的内容。gnome-screensaver doesn't integrate with the screensavers any more than with a small config file that sets the name, some other properties, and a command to execute to start the screensaver. This is documented in the gnome-screensaver FAQ.
The program that gets started needs to get the Window ID from the environment (
XSCREENSAVER_WINDOW
), and start displaying on that window. This is the tricky part, as it's not always obvious how to do that. Most toolkits should have methods to get a handle on an already existing window by giving the ID, so search your GUI-toolkit documentation for something like that.