Event handlers: Example from the application

First, connect the signal:

self.entry.connect("activate", self.sendMessage)

Then, define the handler:

def sendMessage(self, entry):
    self.buffer.insert_at_cursor('%s\n' % self.entry.get_text())
    self.entry.set_text('')