Question

I've got a wx.FileDialog() that currently accepts .zip, .litemod, and .jar (*.zip;*.litemod;*.jar). How can I change this to also accept directories? I would normally think *.zip;*.litemod;*.jar;*, but this would just allow all files.

Était-ce utile?

La solution

You mean you would like to be able to choosing either file or directory from FileDialog? I doubt it is possible (at least couldn't find anything about such possibility in docs). If it would be possible, how should dialog determine whether you want to choose or just enter the directory when you double-click the directory?

There is special dialog type that allows to choose directories: DirDialog. It doesn't allow to select files, though.

UPDATE:

Please, look at this thread. As one of users write:

If you want a file then use wx.FileDialog. If you want a folder then use wx.DirDialog. That's why there are two different classes. If you must be able to select either from the same dialog then you'll need to create your own.

But last answer shows simple implementation of custom dialog. Maybe it will be helpful to you.

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top