event dispacth and listen woes

17 views
Skip to first unread message

flux

unread,
Jul 22, 2016, 1:58:57 PM7/22/16
to Kivy users support
H i

I have the following files in an app

Main.py_________________________________________________________________________________

import kivy
kivy.require('1.9.0') # Kivy ver where the code has been tested!
from kivy.app import App
from kivy.uix.widget import Widget

class MyW(Widget):
def build(self):
pass
class e3App(App):
def build(self):
return MyW()


if __name__ == '__main__':
e3App().run()

e3.kv____________________________________________________________________________________

#:import PlayListView customwidgets.playlistview
#:import SPlayView customwidgets.splayview

<MyW>:


SPlayView:
Button:
on_touch_down:self.parent.buttonPressed()

PlayListView:

splayview.py______________________________________________________________________




from kivy.uix.boxlayout import BoxLayout

class SPlayView(BoxLayout):

def __init__(self,**kwargs):
super(SPlayView,self).__init__()

self.register_event_type('on_john')

def buttonPressed(self):
self.dispatch('on_john')

def on_john(self):
print 'event dispatched'

playlistview.py____________________________________________________________________


from kivy.uix.boxlayout import BoxLayout

class PlayListView(BoxLayout):

def __init__(self,**kwargs):
super(PlayListView,self).__init__(**kwargs)
self.bind(on_john=self.on_john)

def on_john(self):
print 'hell'

When I press the button the event looks as if it is being dispatched, but it never arrives... What am I doing wrong, do i have to some way force the event to bubble or not get consumed, if so how.

Thanks in advance

Flux
Reply all
Reply to author
Forward
0 new messages