Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Kivy: Hide mouse cursor on desktop

Tags:

python

kivy

I have a fullscreen app and I'm trying to hide the mouse cursor. The setup is Kivy 1.9.0 on Python 3.4.1 for Windows, using the prepared packages.

I have tried the following approaches, with no success:

1- Using Config object:

from kivy.config import Config
Config.set("graphics", "show_cursor", 0)

2- Editing .kivy\config.ini:

[graphics]
.
.
.
show_cursor = 0

3- Using pygame:

import pygame
pygame.init()
pygame.mouse.set_visible(False)

4- Moving the mouse off-screen:

def move_mouse_away(etype, motionevent):
  # this one doesn't get called at all
  Window.mouse_pos = [1400, 1000]

Window.bind(on_motion=move_mouse_away)

5- Using Clock for a similar effect:

Clock.schedule_interval(self._reset_mouse, 0.05)

def _reset_mouse(self, time):
  Window.mouse_pos = [1400, 1400]

I'm a little out of ideas now.

like image 858
MadeOfAir Avatar asked May 07 '15 02:05

MadeOfAir


People also ask

How do I hide the mouse pointer on my screen?

The “Pointer Options” tab displays various mouse settings. Here, in the “Visibility” section, enable the “Hide Pointer While Typing” option. Then click “Apply” and “OK.” And you're all set.


1 Answers

You can use Window.show_cursor

It was added in kivy version 1.9.1

from kivy.core.window import Window
Window.show_cursor = False
like image 136
Thiago Falcao Avatar answered Sep 29 '22 22:09

Thiago Falcao