Cursor image

85 views
Skip to first unread message

Sergey Vdovin

unread,
Apr 11, 2021, 9:48:55 AM4/11/21
to Kivy users support
Hello. How to change the mouse cursor image when the pointer is over a Splitter widget? I want to change it to something like a picture from Windows standard theme to make the user know that it's a resizable zone. Thank you in advance.

Elliot Garbus

unread,
Apr 11, 2021, 10:34:14 AM4/11/21
to kivy-...@googlegroups.com

--
You received this message because you are subscribed to the Google Groups "Kivy users support" group.
To unsubscribe from this group and stop receiving emails from it, send an email to kivy-users+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/kivy-users/215998cb-10ee-4ae4-993f-554778729bb6n%40googlegroups.com.

 

Sergey Vdovin

unread,
Apr 11, 2021, 2:54:00 PM4/11/21
to Kivy users support
Thank you. Sorry for disturbing you, but could you please also suggest a way to implement hover behavior for a widget? I can't understand what module to use. I'm sure it's a common task. I must have overlooked something in Docs
воскресенье, 11 апреля 2021 г. в 17:34:14 UTC+3, ElliotG:

Elliot Garbus

unread,
Apr 11, 2021, 3:07:22 PM4/11/21
to kivy-...@googlegroups.com

Sergey Vdovin

unread,
Apr 12, 2021, 2:55:21 AM4/12/21
to Kivy users support
Thank you very much. I would have never solved it by myself. Though, the task turned out to be a little bit trickier for Splitter widget. If apply the suggested code directly to Splitter (eg., sliding horizontally, sizable_from: 'right'), the cursor change it appearance not only when it is over the resizable zone but also over the whole zone from the left side of the screen to the resizable stripe. The following adjustment works well:  # Check whether the mouse position is in the Splitter        
if (self.width - self.strip_size) < pos[0] and self.width > pos[0]: # instead of if "self.collide_point(*pos):" in this article https://programmer.help/blogs/implementation-of-hover-event-in-kivy-control.html
    Clock.schedule_once(self.mouse_enter_css, 0)
else:
    Clock.schedule_once(self.mouse_leave_css, 0)

воскресенье, 11 апреля 2021 г. в 22:07:22 UTC+3, ElliotG:

Elliot Garbus

unread,
Apr 12, 2021, 7:31:58 AM4/12/21
to kivy-...@googlegroups.com

Glad to hear you got it working!

Reply all
Reply to author
Forward
0 new messages