def onRightPress(self, event): if event.button == 3: if self.save: #save cursor position from previous data self.positions[(self.l, self.pos)] = self.cursor.get_position() x, y = None, None try: while not x and not y: l, pos, x, y = self.dataloader.next() self.save = True #save indices for the next rightButtonClick self.l = l self.pos = pos #clean axes self.axes.cla() #set title of the figure as wafer coordinates self.axes.set_title("%s, %s" % (l, pos)) #give title to axes self.axes.set_xlabel(r'$2\theta$ (deg)') self.axes.set_ylabel(r'intensity (cps)') #plot intensity versus 2theta in log scale self.axes.semilogy(x, y, 'b-', linewidth = 3) #draggable cursor self.cursor = DraggableCursorX(self.axes) self.cursor.connect() self.canvas.draw() except StopIteration: self.cursor.disconnect() self.save = False if not self.saved: self.time_to_save = True