简体   繁体   English

在kivy中更改鼠标光标

[英]Changing mouse cursor in kivy

I searched how to change the cursor icon in kivy, but the only way I found is to change it directly in pygame. 我搜索了如何更改kivy中的光标图标,但我找到的唯一方法是直接在pygame中更改它。 Pygame doesn't support colored or animated gifs as its cursor, so I made an Image widget with Screen as parent and set it to follow the mouse position in the window. Pygame不支持彩色或GIF动画作为其光标,因此我创建了一个Image小部件,其中Screen为父级,并将其设置为跟随窗口中的鼠标位置。

    ScreenManager:
        Screen:
            MyMouse:
                Image:

The problem is... my image doesn't stays always at the top. 问题是...我的形象并不总是保持在最高位置。 Popup and Spinner widgets are drawn over it. 在其上方绘制了Popup和Spinner小部件。

I'm probably doing it the wrong way... 我可能做错了...

Is there a simple way to do what I want? 有一种简单的方法可以做我想要的吗?

Try to use Scatter instead of Image like this: 尝试使用Scatter代替Image,如下所示:

class MyMouse(Scatter):
    self.add_widget('yourimage.jpg')
    self.auto_bring_to_front = True

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM