r5 - 01 Aug 2003 - 17:32:50 - KaitlinDuckSherwoodYou are here: OSAF >  Projects Web  >  ChandlerHome > DeveloperDocumentation > HowToWriteAParcelTutorial > DestroyingDialogs

Destroying Dialogs

Python objects can't own C++ wxWindow dialog objects (they are normally owned by their parent window) and so the __del__ of the Python instances can't be allowed to invoke the C++ destructor. Thus any wxDialogs or menus without a parent (like pop-ups) that you spawn must be explicitly Destroy()ed.

There are a number of convenience functions associated with wxDialogs that do not need to be Destroy()ed since the dialog is destroyed inside the funciton. (Good thing, too: you can't call the wxDialog anyway since the convenience methods do not return an instance of the wxDialog..) There is a pretty authoritative list of wxDialog convenience functions, but a copy of it is:

  • wxCreateFileTipProvider
  • wxFileSelector
  • wxGetColourFromUser
  • wxGetNumberFromUser
  • wxGetPasswordFromUser
  • wxGetTextFromUser
  • wxGetMultipleChoice
  • wxGetSingleChoice
  • wxGetSingleChoiceIndex
  • wxGetSingleChoiceData
  • wxMessageBox
  • wxShowTip

There is another list of dialogs defined in wxPython.lib.dialog.py. They also do not need to be explicitly Destroy()ed. The result of one of these dialog calls is always an instance of DialogResults (which prints nicely in dictionary-esque form).

  • alertDialog (variation of messageDialog)
  • colorDialog (wxColourDialog)
  • colourDialog (wxColourDialog)
  • dirDialog (wxDirDialog)
  • findDialog (does not map to an underlying wx class -- written from scratch)
  • fileDialog (wxFileDialog)
  • fontDialog (wxFontDialog)
  • messageDialog (wxMessageDialog)
  • multipleChoiceDialog (wxMultipleChoiceDialog)
  • openFileDialog (wxFileDialog)
  • saveFileDialog (wxFileDialog)
  • scrolledMessageDialog (wxScrolledMessageDialog)
  • singleChoiceDialog (wxSingleChoiceDialog)
  • textEntryDialog (wxTextEntryDialog)

-- DuckySherwood - 14 Jul 2003

Edit | WYSIWYG | Attach | Printable | Raw View | Backlinks: Web, All Webs | History: r5 < r4 < r3 < r2 < r1 | More topic actions
 
Open Source Applications Foundation
Except where otherwise noted, this site and its content are licensed by OSAF under an Creative Commons License, Attribution Only 3.0.
See list of page contributors for attributions.