Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to change font for entire wxPython application

I have a wxPython application (using 2.8), built with python 2.7.

Is there a way to change the font for the whole application ? I mean, I would like to change font for any wx.StaticText, wx.Button, wx.Combo for every widget that shows "text". Do I need to use the c++ wrapper (wxWidgets), if yes, how ?

like image 793
egesuato Avatar asked Sep 17 '25 11:09

egesuato


1 Answers

You should be able to use inheritance to set all the widgets to the same font, according to this thread:

  • http://bytes.com/topic/python/answers/675500-changing-font-style-size-overall-wx-python-gui-look

The idea is to set the font on the top level parent, such as the wx.Panel. Then all the children will inherit that font.

This older thread mentions that you need to set the font BEFORE you create the widgets. If you need to change the font AFTER, then you'll have to iterate over the child widgets, setting their font individually yourself. I would use parent.GetChildren() to get all or most of them.

like image 163
Mike Driscoll Avatar answered Sep 19 '25 00:09

Mike Driscoll