I've written a script using tkinker
in python
. When I run the script, it receives an input and print that to the console. It is working great.
What I wish to do is add any functionality to my existing script in such a way so that after filling in the inputbox
when I press the get
button, it will print the value in the console and quits automatically. Once again, my existing script is capable of printing values. I need to make that button quit as soon as the printing is done. Any help on this will be highly appreciated.
Here is what I've tried so far:
from tkinter import *
master = Tk()
e = Entry(master)
e.pack()
e.focus_set()
callback = lambda : get_val(e.get())
get_val = lambda item: print(item) #this extra function is for further usage
Button(master, text="get", width=10, command=callback).pack()
master.mainloop()
This is how the inputbox
looks like: