class BrainThread(threading.Thread): def __init__(self, serial, gui): threading.Thread.__init__(self) self.gui = gui self.parser = BrainBandParser(serial) def run(self): counter = 0 while True: # Read a packet of data self.parser.readPacket() counter += 1 if counter > 100: counter = 0 self.gui.updateMeters(self.parser) def state_updated(self, data): # Create a BrainEvent for the WX gui shonk to handle evt = BrainEvent(BrainEventType, -1, data) wx.PostEvent(self.gui, evt)
def __init__(self, serial, gui): threading.Thread.__init__(self) self.gui = gui self.parser = BrainBandParser(serial)