PageRenderTime 8ms CodeModel.GetById 2ms app.highlight 3ms RepoModel.GetById 1ms app.codeStats 0ms

/docs/source/tutorial/009.py

https://bitbucket.org/prologic/circuits/
Python | 34 lines | 17 code | 13 blank | 4 comment | 0 complexity | c5123e9f5ca34a279d5e415d9c0371bb MD5 | raw file
 1#!/usr/bin/env python
 2
 3from circuits import Component, Event
 4
 5class Bark(Event):
 6    """Bark Event"""
 7
 8class Pound(Component):
 9
10    def __init__(self):
11        super(Pound, self).__init__()
12
13        self.bob = Bob().register(self)
14        self.fred = Fred().register(self)
15
16class Dog(Component):
17
18    def started(self, *args):
19        self.fire(Bark())
20
21    def bark(self):
22        print("Woof! I'm %s!" % name)
23
24class Bob(Dog):
25    """Bob"""
26
27    channel = "bob"
28
29class Fred(Dog):
30    """Fred"""
31
32    channel = "fred"
33
34Pound().run()