Last active
October 22, 2019 18:27
-
-
Save me2beats/a649648f6aa942fae31bbd8621889ba3 to your computer and use it in GitHub Desktop.
Shared pattern?
This file contains hidden or 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.app import App | |
from kivy.lang import Builder | |
from MyWidget import MyWidget | |
from kivy.core.window import Window | |
from Shared import Shared | |
class MyApp(App): | |
def build(self): | |
self.root = MyWidget() | |
def on_start(self, *_): | |
Window.bind(mouse_pos=lambda w, p: setattr(Shared, 'mouse_pos', p)) | |
MyApp().run() |
This file contains hidden or 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.widget import Widget | |
from Shared import Shared | |
class MyWidget(Widget): | |
def on_touch_down(self, touch): | |
print (Shared.mouse_pos) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment