My problem: I can't display the value to Text widget when I select a row.
how can I display a value inside the Text widget from the selected row?
I tried using textvariable attribute in Text widget but its not working.
CodePudding user response:
Use insert
method of the Text
widget. Minimal example:
import tkinter as tk
root = tk.Tk()
text = tk.Text(root)
text.pack()
def add_text():
# text.delete(1.0, tk.END) # Uncomment if you need to replace text instead of adding
text.insert(tk.END, f"Some text\n")
tk.Button(root, text="Add text", command=add_text).pack()
root.mainloop()