how to get the words inside a entry tkinter python

Solutions on MaxInterview for how to get the words inside a entry tkinter python by the best coders in the world

showing results for - "how to get the words inside a entry tkinter python"
Hawa
17 Mar 2020
1import tkinter as tk
2from tkinter import ttk
3
4win = tk.Tk()
5
6v = tk.StringVar()
7def setText(word):
8    v.set(word)
9
10a = ttk.Button(win, text="plant", command=setText("plant"))
11a.pack()
12b = ttk.Button(win, text="animal", command=setText("animal"))
13b.pack()
14c = ttk.Entry(win, textvariable=v)
15c.pack()
16win.mainloop()
17