title: Tkinter Notebook widget
body: <p>I am trying to create multiple tabs using <code>ttk.Notebook</code> widget. I am creating a simple multi-tab notepad. but I don't know how to deal with the NoteBook widget. but when I click on save button it overrides all tabs text area that because of I declared there <code>self.tx.get("1.0","end-1c")</code>.all written file change their text according to last text. Thanks for helping me </p>
  
  <pre><code>
      #-*- coding: utf-8 -*-
  
      import tkinter.ttk as ttks
      from tkinter import LEFT,RIGHT,X,Y,BOTH
      class MainUI:
          def __init__(self,master):
              self.master = master
  
              self.nb = ttks.Notebook(self.master)
              self.nb.pack(fill='both',expand=1)
  
              self.name = ttks.Entry(self.master)
              self.name.pack()
              self.save_tab = ttks.Button(self.master,text="save",command=lambda:self.save_file()).pack()
              #tab1
              self.page1 = ttks.Frame(self.nb)
              self.txt = ttks.tkinter.Text(self.page1)
              self.txt.pack(fill='both',expand=1)
              self.nb.add(self.page1,text="tab1")
  
              self.page2 = ttks.Frame(self.nb)
              self.nb.add(self.page2,text="tab2")
              self.master.bind('',self.add_tabs)
  
          def add_tabs(self,event):
              self.page_name = ttks.Frame(self.nb)
              self.tx = ttks.tkinter.Text(self.page_name)
              self.tx.pack(fill=BOTH,expand=1)
              self.nb.add(self.page_name,text="pagename")
  
          def save_file(self):
              self.fname = self.name.get()
              self.txtinput = self.tx.get("1.0","end-1c")
              with open(self.fname,'w') as f:
                  f.write(self.txtinput)
  
      if __name__ == "__main__":
          root = ttks.tkinter.Tk()
          root.title('Tabs>>')
          root.geometry('500x500')
          MainUI(root)
      root.mainloop()
  </code></pre>
  
  <p><a href="https://i.stack.imgur.com/veuyv.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/veuyv.jpg" alt="enter image description here"></a></p>
  
  <p><a href="https://i.stack.imgur.com/UQXJ5.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/UQXJ5.jpg" alt="enter image description here"></a></p>
  
  <p>after Implementing below code got following Exception
  <a href="https://i.stack.imgur.com/KBP72.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/KBP72.jpg" alt="enter image description here"></a></p>