gpt4 book ai didi

python - 如何设置 Gtk.FileChooserWidget 的默认打开路径?

转载 作者:太空宇宙 更新时间:2023-11-03 15:21:06 28 4
gpt4 key购买 nike

如果我通过 Gtk.FileChooserWidget.set_current_folder() 方法设置当前文件夹,我第一次打开文件选择器时,它会在用作 set_current_folder( )

但是,如果我选择一个文件,我会重新打开文件选择器,它会在“most_recent_used_files”上打开。

我希望它在最后选择的文件的文件夹路径中打开。

怎么做?

谢谢。

最佳答案

来自文档:

Old versions of the file chooser's documentation suggested using gtk_file_chooser_set_current_folder() in various situations, with the intention of letting the application suggest a reasonable default folder. This is no longer considered to be a good policy, as now the file chooser is able to make good suggestions on its own. In general, you should only cause the file chooser to show a specific folder when it is appropriate to use gtk_file_chooser_set_filename() - i.e. when you are doing a File/Save As command and you already have a file saved somewhere.

您可能喜欢也可能不喜欢这种行为的原因。如果您对它是如何产生的感到好奇,请参阅 File chooser recent-files在邮件列表和Help the user choose a place to put a new file在 GNOME 维基上。

关于python - 如何设置 Gtk.FileChooserWidget 的默认打开路径?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14683093/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com