from nagare import presentation class Counter(object): def __init__(self): self.val = 0 def increase(self): self.val += 1 def decrease(self): self.val -= 1 @presentation.render_for(Counter) def render(counter, h, *args): h << h.div('Value: ', counter.val) # action method allows to register callbacks on HTML elements # that can have actions (links, inputs, etc.) h << h.a('++').action(counter.increase) h << '|' h << h.a('--').action(counter.decrease) return h.root app = Counter