Bug in wx.FileDialog?

According to the wx.FileDialog documentation at

http://wxpython.org/docs/api/wx.FileDialog-class.html#SetWildcard

the filter (“wildcard”) should look like this (for example):

“Python source (.py)|.py|Text files (.txt)|.txt”

However, there seems to be a bug in wx.FileDialog, because either

“Python source (.py)|.py”

or

“Text files (.txt)|.txt”

works as expected, but not both simultaneously.

Here is how I’m calling it:

dlg = wx.FileDialog(
    None, message="Choose a file",
    defaultDir=os.getcwd(),
    defaultFile="",
    wildcard=wildcard,
    style=wx.OPEN | wx.CHANGE_DIR
    )

Am I doing something wrong?

Can you describe what’s happening ?

Does it shows only py files ? Or only txt files ? Or all kind of files ?

And what do you want ? The wildcard you typed will not show both type of files at once, but you will have to choose the file type.

To show both type at once, you should use a wildcard like this:

“Python and text files|.py;.txt”

Hope this helps.

Basil

···

Le samedi 2 mai 2015 20:23:44 UTC+2, Bruce Sherwood a écrit :

According to the wx.FileDialog documentation at

http://wxpython.org/docs/api/wx.FileDialog-class.html#SetWildcard

the filter (“wildcard”) should look like this (for example):

“Python source (.py)|.py|Text files (.txt)|.txt”

However, there seems to be a bug in wx.FileDialog, because either

“Python source (.py)|.py”

or

“Text files (.txt)|.txt”

works as expected, but not both simultaneously.

Here is how I’m calling it:

dlg = wx.FileDialog(
    None, message="Choose a file",
    defaultDir=os.getcwd(),
    defaultFile="",
    wildcard=wildcard,
    style=wx.OPEN | wx.CHANGE_DIR
    )

Am I doing something wrong?

It helps enormously. The information in the help wasn’t enough. Thanks much!