JoyCursor¶
New in version 1.10.0.
The JoyCursor is a tool for navigating with a joystick as if using a mouse or touch. Most of the actions that are possible for a mouse user are available in this module.
For example:
- left click
- right click
- double click (two clicks)
- moving the cursor
- holding the button (+ moving at the same time)
- selecting
- scrolling
There are some properties that can be edited live, such as intensity of the JoyCursor movement and toggling mouse button holding.
Usage¶
For normal module usage, please see the modules
documentation
and these bindings:
Event | Joystick |
---|---|
cursor move | Axis 3, Axis 4 |
cursor intensity | Button 0, Button 1 |
left click | Button 2 |
right click | Button 3 |
scroll up | Button 4 |
scroll down | Button 5 |
hold button | Button 6 |
joycursor on/off | Button 7 |
The JoyCursor, like Inspector, can also be imported and used as a normal python module. This has the added advantage of being able to activate and deactivate the module programmatically:
from kivy.lang import Builder
from kivy.base import runTouchApp
runTouchApp(Builder.load_string("""
#:import jc kivy.modules.joycursor
BoxLayout:
Button:
text: 'Press & activate with Ctrl+E or Button 7'
on_release: jc.create_joycursor(root.parent, root)
Button:
text: 'Disable'
on_release: jc.stop(root.parent, root)
"""))
-
kivy.modules.joycursor.
stop
(win, ctx)[source]¶ Stop and unload any active JoyCursors for the given ctx.
-
kivy.modules.joycursor.
create_joycursor
(win, ctx, *args)[source]¶ Create a JoyCursor instance attached to the ctx and bound to the Window’s
on_keyboard()
event for capturing the keyboard shortcuts.