How to save askdirectory result in a variable I can use using tkinter with OOP?

后端 未结 1 564
执念已碎
执念已碎 2021-01-28 14:48

I have ran into some trouble. I\'m quite new to OOP and working with tkinter and GUI\'s in general.

I have managed to find some code on the Internet and mes

相关标签:
1条回答
  • 2021-01-28 15:30

    I had an idea:

    example, if you have f inside a function, you can make it global to have access as variable

    def print_path():  
        # select working directory
        global f #make f global to access the path
        f = filedialog.askdirectory(parent=root, initialdir="/", title='Select Dir') 
    
    0 讨论(0)
提交回复
热议问题