PageRenderTime 22ms CodeModel.GetById 19ms app.highlight 1ms RepoModel.GetById 2ms app.codeStats 0ms

/docs/source/tutorial/006.py

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