Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我正在开发一个 gui,用户必须在其中浏览选择 a 目录。然后我需要将目录路径保存为变量并由导入的类使用。
到目前为止,我已经编写了使用户能够选择目录但并没有被困在下一步做什么的代码。我到目前为止的代码如下:
def loadDirectory(): directory = filedialog.askdirectory()
通过按下按钮调用该函数。
提前致谢
这个比较简单。
import chrome def loadDirectory(): chrome.directory = filedialog.askdirectory()
这应该做你想要的。