Aug-05-2018, 05:13 PM
(Aug-05-2018, 12:58 PM)Windspar Wrote: 1. Don't flood namespace.
from Tkinter import *this is better.
import Tkinter as tkExample. Every thing seems to be working find.
import Tkinter as tk class Menu: def __init__(self,master): self.master=master self.var1 = tk.StringVar() self.entry = tk.Entry(self.master, textvariable=self.var1) self.entry.pack(side=tk.TOP) self.button = tk.Button(self.master,text='Hit Me',command = self.get_value) self.button.pack(side=tk.TOP) self.value = None def get_value(self): print(self.entry.get()) print(self.var1.get()) self.value = self.entry.get() print(self.value) if __name__=="__main__": root = tk.Tk() menu = Menu(root) root.mainloop()
Hi Windspar,
Thanks for your input.But what I want is to return the input value to a variable in the main program so that I can use t for other purpose. Actually my idea is to make one FTP GUI app so that user will provide input in GUI app & after the pressing Hit Me button the main program will be able to fetch the input details of user from this GUI. In this program if I am trying to return a value the output is coming as None. So, please tell me how I can use this input in entry box to another program? Again thank you very much for your input.