title: How to connect multiple text to one scrollbar with Tkinter
body: <p>Im coding my personal text editor. But i have a problem with the 2 widget text and the scrollbar (connect one scrollbar to two text).</p>
  
  <p><strong><em>What is my idea and logic (at the beginning)?</em></strong></p>
  
  <p>I want to display 2 text, one for writing text entered by user, and one to display the number of the line. I pack both of them, in the root. Then i create a scrollbar, that will scroll on Y axes the 2 text, so what i want to do (mainly) is to connect 2 widget (text) to one scrollbar.</p>
  
  <p><strong><em>But it didn't work.</em></strong></p>
  
  <p>This system absolutely doesn't work, are there any suggest or fix to fix this first idea?</p>
  
  <p><strong><em>Other ideas that i found.</em></strong></p>
  
  <p>After the first attempt, i thought that i can pack the 2 texts into 1 container. I tried to create a frame (packed into root) that contains the 2 texts, i did this because i have to connect the scrollbar only to the frame. But it didn't work, moreover it didnt allow me to write the following snippet: <code>command=frame.yview</code> in the scrollbar option, it seems that i cant connect frame to scrollbar.</p>
  
  <p><strong><em>So:</em></strong></p>
  
  <p>I will ask u if my reasoning are good, and how to solve. If not what can i do?</p>
  
  <p><strong><em>Similar question found on Google:</em></strong> (but that i dont undestand)</p>
  
  <p><a href="https://stackoverflow.com/questions/35957671/how-to-scroll-two-parallel-text-widgets-with-one-scrollbar">How to scroll two parallel text widgets with one scrollbar?</a></p>
  
  <p><a href="https://stackoverflow.com/questions/16369470/tkinter-adding-line-number-to-text-widget">Tkinter adding line number to text widget</a></p>
  
  <pre><code>from tkinter import *
  
  
  root = Tk()
  
  root.geometry("480x540+100+100")
  root.config(cursor='')
  
  line = Text(root, bg="light grey", font="Roman 24", width=4)
  line.pack(side=LEFT, fill=BOTH)
  
  text = Text(root, bg="grey", font="Roman 24")
  text.pack(side=LEFT, fill=BOTH, expand=True)
  
  scrollbar = Scrollbar(text, orient=VERTICAL, command=(line.yview, text.yview))
  text.configure(yscrollcommand=scrollbar.set)
  line.configure(yscrollcommand=scrollbar.set)
  scrollbar.pack(side=RIGHT, fill=Y)
  
  for n in range(50):
      line.insert("{}.0".format(n+1), "{}\n".format(n+1))
      text.insert("{}.0".format(n+1), "Line no. {}\n".format(n+1))
  
  if __name__ == '__main__':
      root.mainloop()
  </code></pre>