I am a beginner and I am aware that I must not be following proper coding procedure. I have all my functions in one file and I have been passing four parameters to this file, but i really need user input. I cannot figure out how to get four parameters from the user. I added the recommendations from the user , but I still do not get the data that I am looking for
I am using Winpython 2.7.5.
I would like to get three Strings which works in a standalone version as posted here on stackoverflow. How do I print and have user input in a text box in tkinter, Python 3.2.5?
then I would like the user to open a file dialog box and pick a text file, similar to filedialog, tkinter and opening files
if I use the code below, then I can not access the returned values for the file name
import Tkinter, tkFileDialog
def myDialog():
root = Tkinter.Tk()
results = []
label1 = Tkinter.Label( root, text="Header")
E1 = Tkinter.Entry(root, bd =5)
label2 = Tkinter.Label( root, text="Machine Name")
E2 = Tkinter.Entry(root, bd =5)
label3 = Tkinter.Label( root, text="final filename")
E3 = Tkinter.Entry(root, bd =5)
def getDate():
results.append(E1.get())
results.append(E2.get())
results.append(E3.get())
root.destroy() # close the window
def getFile():
results.append(tkFileDialog.askopenfilename())
submit = Tkinter.Button(root, text ="Submit", command = getDate)
openfiledialog = Tkinter.Button(root, text ="Open File", command = getFile)
label1.pack()
E1.pack()
label2.pack()
E2.pack()
label3.pack()
E3.pack()
submit.pack(side =Tkinter.LEFT)
openfiledialog.pack(side =Tkinter.RIGHT)
root.mainloop() # the mainloop is used to paint the gui and react on input
return results
checkresults = []
checkresults = myDialog