/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
- #!/usr/bin/env python
- from circuits import Component, Event
- class Bark(Event):
- """Bark Event"""
- class Pound(Component):
- def __init__(self):
- super(Pound, self).__init__()
- self.bob = Bob().register(self)
- self.fred = Fred().register(self)
- class Dog(Component):
- def started(self, *args):
- self.fire(Bark())
- def bark(self):
- print("Woof! I'm %s!" % name)
- class Bob(Dog):
- """Bob"""
- channel = "bob"
- class Fred(Dog):
- """Fred"""
- channel = "fred"
- Pound().run()