subclass dialog or put in the resource files?

flupke flupke at nonexistingdomain.com
Thu May 12 10:56:39 EDT 2005


flupke wrote:
> 
> I'm using wxPython and design the gui via wxglade. One of the gui 
> components is a simple dialog class that gets displayed when a user 
> exits the program.
> I want to use the same dialog but with a different text for closing 
> certain dialogs in the program. (it's a pure "do you want to exit 
> <insert screen name>" dialog)
> 
> What would i better use, knowing the rest of the gui is in a resource 
> (xrc) file:
> 
> 1. Find some way to put a standard exit dialog in the resource file and 
> then somehow try to set the message to the correct one.
> 
> 2. Make a simple dialog class that accepts the message to be displayed. 
> I could even use glade to generate the python code for a start.
> 
> What would be the better/cleaner/logical way to do this?
> 
> Thanks,
> Benedict

I found what i was looking for.
I first load the dialog from the resource files and then i change the 
text like this:

children = self.d_exit.GetChildren()
for control in children:
     if ( type(control) is wx.StaticText ):
         control.SetLabel("<new message>")

Benedict



More information about the Python-list mailing list