I had a question...Im using TKinter in python trying to build a GUI to run some command prompt scripts others have made. I am having some trouble though...pretty early on...
I can open a file and get the file name, but I can not even pass the file name to another function. I'm sure this is an easy fix I have been struggling with it for a day and can't figure it out. Thanks.
So I have created 2 buttons,
Class App: def __init__(self, masterb) frame = Frame(masterb) frame.pack() Button(frame, text="open", command=self.askopenfilename).pack(side=LEFT) Button(frame, text="execute", command=self.printdef).pack(side=LEFT) root.mainloop() def askopenfilename(self) filename = tkFileDialog.askopenfilename(**self.options) print filename return filename #so far this works fine...the problem I have is taking the filename string and using it in another function. I feel like this is very easy and basic to do I just cant do it. def printdef() words = askopenfilename(filename) #I've also tried words = askopenfilename() print words root = Tk() app = App(root)