[wxPython] wxFileDialog on Windows and Linux

Hello,

I'm trying to achieve similar behavior of wxFileDialog on Windows and Linux but I'm striking out. On Win2000 the sample code below shows all files with the extensions (tif, bmp, jpg) in a particular directory. On Linux (RH 7.1, GTK 1.2.9) none of the files show up, thus there is no way to select a file by clicking on it.

I read the docs and I know that the two implementations are different, but is there some way of making the Linux version see the wildcard extensions?

     def OnOpen(self, event):
         fileTypes = 'All image files (tif, bmp, jpg...)| \
             *.tif;*.bmp;*.jpg'
         fd = wxFileDialog(self, "Open Image", "", "", fileTypes, wxOPEN)

         if fd.ShowModal() == wxID_OK:
             path = fd.GetPath()
             self.LoadImage(path)
         fd.Destroy()

Regards,
Bob

I may be reading this wrong or perhaps it doesn't matter, but off the cuff I
see that you have your file extensions in the default file field, actually
it's missing the default file field.

Docs say args are (self,message,deafult dir,default file,wildcard,style)
You have (self,message,deafult dir,wildcard,style)

Hope that's of use.
Rick

···

----- Original Message -----
From: "Bob Klimek" <klimek@grc.nasa.gov>
To: <wxpython-users@lists.wxwindows.org>
Sent: Wednesday, June 20, 2001 11:00 AM
Subject: [wxPython] wxFileDialog on Windows and Linux

Hello,

I'm trying to achieve similar behavior of wxFileDialog on Windows and

Linux

but I'm striking out. On Win2000 the sample code below shows all files

with

the extensions (tif, bmp, jpg) in a particular directory. On Linux (RH

7.1,

GTK 1.2.9) none of the files show up, thus there is no way to select a

file

by clicking on it.

I read the docs and I know that the two implementations are different, but
is there some way of making the Linux version see the wildcard extensions?

     def OnOpen(self, event):
         fileTypes = 'All image files (tif, bmp, jpg...)| \
             *.tif;*.bmp;*.jpg'
         fd = wxFileDialog(self, "Open Image", "", "", fileTypes, wxOPEN)

         if fd.ShowModal() == wxID_OK:
             path = fd.GetPath()
             self.LoadImage(path)
         fd.Destroy()

Regards,
Bob

_______________________________________________
wxpython-users mailing list
wxpython-users@lists.wxwindows.org
http://lists.wxwindows.org/mailman/listinfo/wxpython-users

I'm trying to achieve similar behavior of wxFileDialog on Windows and

Linux

but I'm striking out. On Win2000 the sample code below shows all files

with

the extensions (tif, bmp, jpg) in a particular directory. On Linux (RH

7.1,

GTK 1.2.9) none of the files show up, thus there is no way to select a

file

by clicking on it.

         fileTypes = 'All image files (tif, bmp, jpg...)| \
             *.tif;*.bmp;*.jpg'

Looks like the generic file dialog doesn't support the ; syntax but only
expects one wildcard after the |. If you want to look into fixing this the
source is in wxWindows/src/generic/filedlgg.cpp

···

--
Robin Dunn
Software Craftsman
robin@AllDunn.com Java give you jitters?
http://wxPython.org Relax with wxPython!

--
Robin Dunn
Software Craftsman
robin@AllDunn.com Java give you jitters?
http://wxPython.org Relax with wxPython!