'whenever a key is pressed'

def key_press_callback(self, event):

    if (not event.inaxes):
        return
    if (event.key == 't'):
        self.showverts = (not self.showverts)
        self.line.set_visible(self.showverts)
        if (not self.showverts):
            self._ind = None
    self.canvas.draw()
