I want to change the font of my applications dynamically.
Is there a simple way to do that ?
If the only way is to traverse to all the widgets,
is there a simple way to traverse to all widgets ?
For the moment I use the following procedure:
- present a font dialog to the user
- store the selected font in a config file
- ask the user to restart the application
- in the main frame, the font is read from the config file
thanks,
Stef Mientki
I think I've seen Robin mention that on Windows, you can set the font
on the Frame and most of the children will pick it up automatically,
but that doesn't work cross-platform.
You'd probably be better off using GetChildren() to get the widgets
and then loop over them. Something like this:
<code>
children = myPanel.GetChildren()
for child in children:
child.SetFont(font)
</code>
If only need to set certain types of widgets, then you'd need to use a
conditional along with isinstance.
···
On Mar 23, 8:35 am, Stef Mientki <stef.mien...@gmail.com> wrote:
It should work elsewhere as well. Basically if a parent window has a non-standard font set when the child is created then the child will "inherit" that font. However since Stef is wanting to change the fonts after the fact this doesn't help much.
You'll need to do a recursive decent of the windows and their children calling SetFont on each.
···
On 3/23/10 8:30 AM, Mike Driscoll wrote:
Hi Stef,
On Mar 23, 8:35 am, Stef Mientki<stef.mien...@gmail.com> wrote:
hello,
I want to change the font of my applications dynamically.
Is there a simple way to do that ?
If the only way is to traverse to all the widgets,
is there a simple way to traverse to all widgets ?
For the moment I use the following procedure:
- present a font dialog to the user
- store the selected font in a config file
- ask the user to restart the application
- in the main frame, the font is read from the config file
thanks,
Stef Mientki
I think I've seen Robin mention that on Windows, you can set the font
on the Frame and most of the children will pick it up automatically,
but that doesn't work cross-platform.