title: How to get selected text in multiple text widget in python?
body: <p>i am trying to write little python tkinter app that show selected text (with mouse) another label. But i'm having problems with multiple text widget. How do i know which text widget i use? There are 10 text widget and when i select a text from any widget it should show the label. I'm using python 3.4.2 on windows 7. Thanks a lot.</p>
  
  <pre><code>#! python3
  # -*- coding: utf8 -*-
  
  from tkinter import *
  
  class omniAnaliz(Frame):
      def __init__(self, master):
          Frame.__init__(self, master)
          self.screen()
  
      def screen(self):
          self.t1 = Text(self, height=1, width=50)
          self.t1.pack(side='top')
          self.t1.insert(END, '1D D6 F8 F0 C3 08 04 00 62 63 64 65 66 67 68 69')
          self.t1.configure(state="disabled")
  
          self.t2 = Text(self, height=1, width=50)
          self.t2.pack(side='top')
          self.t2.insert(END, '30 F0 F8 D6 1D 64 64 01 00 71 1D 9F 00 1D 9F 00')
          self.t2.configure(state="disabled")
  
          # More text widget
  
          self.l1 = Label(self)
          self.l1.pack(side='top')
  
          self.t1.bind("&lt;Button-3&gt;", self.hex2dec)
          self.t2.bind("&lt;Button-3&gt;", self.hex2dec)
  
      def hex2dec(self, event):
          self.l1.config(text=self.t1.get(SEL_FIRST, SEL_LAST))
  
  if __name__ == '__main__':
      root = Tk()
      omniAnaliz(root).pack()
      root.mainloop()
  </code></pre>