code: def gen_accel_switch_tabN(self, N):
          
  
          def callback(*args):
              if 0 <= N < self.get_notebook().get_n_pages():
                  self.get_notebook().set_current_page(N)
              return True
  
          return callback
docs: Generates callback (which called by accel key) to go to the Nth tab.