Guys you have to help me, I'm completely lost.
I have a window, with an Entry, a button and a textfield. When I push the load-Button and pick a file, I want the resulting filename to be displayed in the Entry.
I searched long time, but I seem to be too dumb to find.
I mean, I think it is easy to do with classes, but why should I need a class for this?!
By the way: If you start this, the file open dialog displays even without pushing the load button and won't start, if pushed. Don't know about this problem too. ![]()
CODE
from Tkinter import *
from tkFileDialog import askopenfile
wwidth=300
wheight=300
def load():
file=askopenfile(mode='r')
filepath = str(file)
return filepath
app = Tk()
topframe = Frame(width=wwidth, height=wheight/10)
topframe.pack()
botframe = Frame(width=wwidth, height=wheight/10*9)
botframe.pack()
btnLoad = Button(app, text="Load nuke file!", command=load())
btnLoad.pack()
btnLoad.place(x=375, y=2)
namefield = Entry(app, text="test", width=60)
namefield.insert(END,"hi") ### INSTEAD OF hi I WANT THE FILEPATH HERE
namefield.pack()
namefield.place(x=5, y=2)
app.columnconfigure(0, weight=5)
app.columnconfigure(1, weight=1)
infofield = Text(botframe)
infofield.pack()
app.protocol("WM_DELETE_WINDOW", app.quit)
app.mainloop()
app.destroy()