subclass dialog or put in the resource files?

F

flupke

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
 
F

flupke

flupke said:
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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,434
Messages
2,571,685
Members
48,796
Latest member
Greg L.

Latest Threads

Top