Created
July 16, 2017 20:34
-
-
Save Bakterija/f9735ff0958b53b890c1419f4ce0d665 to your computer and use it in GitHub Desktop.
SDL2 system cursors with kivy sdl2_cursors branch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from kivy.uix.floatlayout import FloatLayout | |
from kivy.uix.gridlayout import GridLayout | |
from kivy.properties import StringProperty | |
from kivy.uix.boxlayout import BoxLayout | |
from kivy.core.window import Window | |
from kivy.uix.button import Button | |
from kivy.app import runTouchApp | |
from kivy.lang import Builder | |
from kivy.clock import Clock | |
class RootWid(GridLayout): | |
cols = 4 | |
rows = 4 | |
def __init__(self, **kwargs): | |
super(RootWid, self).__init__(**kwargs) | |
for x in ('arrow', 'ibeam', 'wait', 'wait_arrow', 'crosshair', | |
'size_nwse', 'size_nesw', 'size_we', 'size_ns', | |
'size_all', 'no', 'hand'): | |
self.add_widget(CursorSetterButton(cursor_name=x, text=x)) | |
class CursorSetterButton(Button): | |
cursor_name = StringProperty() | |
def on_press(self): | |
Window.set_system_cursor(self.cursor_name) | |
Builder.load_string(''' | |
<RootWid> | |
''') | |
runTouchApp(widget=RootWid()) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment