I'm creating a file dialog that allows the user to save a file after editing it in my app. I want to add a checkbox to the dialog so the user can make some choices about what format the file is saved in. I think I need to make some new class that inherits from FileDialog and inserts a checkbox into the frame created by the filedialog, but I don't really know how to do that. Can anyone help me out?
(I also want to create an analogous file dialog for opening a file, but I assume that will just mean replacing the SAVE style with the OPEN style.)
I think you are going the wrong way about this. In general extra widgets aren't ment to be added to the standard dialogs (they wouldn't really be standard if you could).
If you wish to add wx.CheckBox
's or the like the you going to have to create your own custom dialog by subclassing wx.Dialog.
If all you need to do is to provide the user with a means of filtering by file-types to be opened or select which file-type the file is to be saved as, then this functionality is all ready provided by wx.FileDialog.
By using the wildcard paramater when creating an instance of your fileDialog you can supply a group of file-types for the user to choose from.
Here's a snippet from the wxPython Demo and a screenshot to illustrate. The wxPython Demo is very usefull application which provides demos of most of the widgets included with wxPython, a worthwhile download if you don't already have it.
wildcard = "Python source (*.py)|*.py|" \
"Compiled Python (*.pyc)|*.pyc|" \
"SPAM files (*.spam)|*.spam|" \
"Egg file (*.egg)|*.egg|" \
"All files (*.*)|*.*"
wx.FileDialog Documentation:
http://wxpython.org/docs/api/wx.FileDialog-class.html
http://xoomer.virgilio.it/infinity77/wxPython/Widgets/wx.FileDialog.html