With Nagare, every element of an application is a component which can embed is
own view, logic and data. Also components can communicate each other with the
'answer' / 'on_answer' mechanism.
So what is called "widgets" in other frameworks are only normal components in Nagare,
just with, in general, a predominant view part and a thin data part.
Then this widget can be embedded in any view of an other component:
class App(object):
def __init__(self):
self.dropdown = component.Component(DropdownButton(('Action', 'Another Action', 'Something else here')))
self.dropdown.on_answer(self.print_selection)
def print_selection(self, i):
print 'Entry #%d selected' % (i + 1)
@presentation.render_for(App)
def render(self, h, *args):
h.head << h.head.meta(name='viewport', content='width=device-width, initial-scale=1')
with h.div(class_='container'):
h << h.h1('Bootstrap widget example')
with h.div(class_='container'):
h << self.dropdown
return h.root
Note how the 'DropdownButton' and the 'App' components are exactly defined in the same way.
Hope this help.
Best regards,
Alain