Jun-18-2019, 07:16 AM
Hi,
I have two text area and two separate scroll bar assigned for them. i need a single scrollbar which can scroll both area ? is that possible?? attaching my code below and current UI.
I have two text area and two separate scroll bar assigned for them. i need a single scrollbar which can scroll both area ? is that possible?? attaching my code below and current UI.
root = tk.Tk()
textContainer = tk.Frame(root, borderwidth=1, relief="sunken")
root.title("Comparison")
#First Text Window
text = tk.Text(textContainer, width=24, height=13, wrap="none", borderwidth=0)
textVsb = tk.Scrollbar(textContainer, orient="vertical", command=text.yview)
textHsb = tk.Scrollbar(textContainer, orient="horizontal", command=text.xview)
text.configure(yscrollcommand=textVsb.set, xscrollcommand=textHsb.set)
text.insert(tkinter.INSERT,Source_Value)
text.grid(row=0, column=0, sticky="nsew")
textVsb.grid(row=0, column=1, sticky="ns")
textHsb.grid(row=1, column=0, sticky="ew")
#Second Text Window
text1 = tk.Text(textContainer, width=24, height=13, wrap="none", borderwidth=0)
text1Vsb = tk.Scrollbar(textContainer, orient="vertical", command=text1.yview)
text1Hsb = tk.Scrollbar(textContainer, orient="horizontal", command=text1.xview)
text1.configure(yscrollcommand=text1Vsb.set, xscrollcommand=text1Hsb.set)
text1.insert(tkinter.INSERT,Target_Value)
text1.grid(row=0, column=2, sticky="nsew")
text1Vsb.grid(row=0, column=3, sticky="ns")
text1Hsb.grid(row=1, column=2, sticky="ew")
textContainer.grid_rowconfigure(0, weight=1)
textContainer.grid_columnconfigure(0, weight=1)
textContainer.grid_columnconfigure(2, weight=1)
