Mar-01-2018, 10:28 AM
Hi All,
I need to get the text of the textbox (ScrolledText) by pressing the "Find" button. At the moment the command prints the text entered but I need to set a global variable that contains this text.
This is the Python code
Thanks in advance for your kind support.
Regards,
Giovanni
I need to get the text of the textbox (ScrolledText) by pressing the "Find" button. At the moment the command prints the text entered but I need to set a global variable that contains this text.
This is the Python code
from tkinter import * from tkinter.scrolledtext import ScrolledText mainwin = Tk() Label(mainwin, text="Title").grid(row=0, column=1) Label(mainwin, text="Insert description").grid(row=1, column=0) st = ScrolledText(mainwin, height=5); st.grid(row=1, column=1) Button(mainwin, text="Find", command=(lambda: print(st.get(1.0, END)))).grid(row=1, column=2, sticky="EW") Label(mainwin, text="Watson Answer:").grid(row=2, column=0) Button(mainwin, text="Exit", command=sys.exit).grid(row=3, column=0, columnspan=3, sticky="EW") mainwin.mainloop()Any help will be greatly appreciated.
Thanks in advance for your kind support.
Regards,
Giovanni