user11064240
user11064240

Reputation: 23

How do I get the path of a file I want to upload by a file entry?

I want to upload a file by a file entry and then when I click on "Save" I want to get the path of this selected file.

The next step would be to create either a .txt or a yaml file with this path in it as output.

Could someone help me with this?

win.addFileEntry("InputFile")
def press(button):
    if button == "Exit":
        win.stop()
    if button == "Save":
        print(path._getfullpathname(__file__))
        print("Saved!")

win.addButtons(["Add", "Remove", "Save", "Load", "Exit"], press)

Upvotes: 0

Views: 126

Answers (1)

R.Jarvis
R.Jarvis

Reputation: 273

You just need to ask the FileEntry for its contents: filename = win.getEntry('InputFile')

Upvotes: 0

Related Questions