简体   繁体   中英

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. 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.

    ScreenManager:
        Screen:
            MyMouse:
                Image:

The problem is... my image doesn't stays always at the top. Popup and Spinner widgets are drawn over it.

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:

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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