title: Event handler for left-click on Notebook tabs in Tkinter
body: <p>In Tkinter, I want to make it so when I click one or more times on an already open/selected tab of a Notebook object so that it does not take the focus (or so that it gives the focus back to the Text widget in the window).</p>
  
  <p>How do I do this?</p>
  
  <p>If there's an event handler for clicking on tabs, that would more than suffice.</p>
  
  <p>Also, if there's an ability to make it so widgets will take events, but not take the focus, that would be great.</p>
  
  <p>I already know about the virtual event <code>&lt;&lt;NotebookTabChanged&gt;&gt;</code>. However, I'm talking about when you click on an already selected tab. So, the tab isn't changing. I tried just binding the <code>&lt;Button-1&gt;</code> event to the Notebook widget, but it didn't do anything.</p>
  
  <p>Since making Notebooks isn't common knowledge to everyone who uses Tkinter, here's an example of how to make a minimal Notebook with tabs. I don't know why the text is cut off in the final tab here, though (but it's not in my full code):</p>
  
  <pre><code>from tkinter import *;
  from tkinter.ttk import *; #Notebook comes from this
  
  class Editor:
      def __init__(self):
          self.tk=Tk();
          self.tabs=0;
          self.frame=Frame(self.tk);
          self.nb=Notebook(self.frame);
          self.frame.pack();        
          for x in range(5):
              self.add_tab();
          self.nb.pack();
          self.tk.mainloop();
      def add_tab(self):
          newTabFrame=Frame(self.nb);
          text=Text(newTabFrame); #Just a sample Text widget to go in each tab
          text.pack();
          if self.tabs==0:
              self.nb.add(newTabFrame, text=str(self.tabs), compound=TOP);
          else:
              self.nb.add(newTabFrame, text=str(self.tabs));
          self.tabs+=1;
  
  if __name__ == '__main__':
      e=Editor();
      try:
          e.tk.destroy();
      except:
          pass;
  </code></pre>