[英]Setting mouse cursor in pyglet
I'm trying to set the mouse cursor in a pyglet application. 我正在尝试在pyglet应用程序中设置鼠标光标。 According to the pyglet documentation, this is how I should go about this: 根据pyglet文档,这就是我应该这样做的方式:
import pyglet
window = pyglet.window.Window()
cursor = window.get_system_mouse_cursor(win.CURSOR_HELP)
window.set_mouse_cursor(cursor)
pyglet.app.run()
However, this gives me the following error: 但是,这给了我以下错误:
cursor = window.get_system_mouse_cursor(win.CURSOR_HELP)
NameError: name 'win' is not defined
How can I do this without using my own cursor image files? 不使用自己的光标图像文件怎么办? I'm on linux if that helps. 如果有帮助,我在linux上。
The CURSOR_HELP attribute is a member of your window class. CURSOR_HELP属性是您的窗口类的成员。
Change 更改
win.CURSOR_HELP
to 至
window.CURSOR_HELP
Found here: https://pyglet.readthedocs.io/en/pyglet-1.2-maintenance/api/pyglet/window/pyglet.window.Window.html#pyglet.window.Window.CURSOR_HELP 在这里找到: https : //pyglet.readthedocs.io/en/pyglet-1.2-maintenance/api/pyglet/window/pyglet.window.Window.html#pyglet.window.Window.CURSOR_HELP
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.