tags:

views:

370

answers:

1

What's the right way to use a monospaced font for all text in a StyledTextCtrl? I'm using it over the simpler TextCtrl because I need the FindText() functionality which is oddly missing from a standard text control.

I'd also like to avoid hard-coding a specific font face, and instead rely on the monospace font defined by the system if possible.

A: 

I think this is what I'm looking for. Can anybody improve upon this?

font = wx.Font(9, wx.FONTFAMILY_MODERN, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_NORMAL)
face = font.GetFaceName()
size = font.GetPointSize()
self.out.StyleSetSpec(wx.stc.STC_STYLE_DEFAULT,"face:%s,size:%d" % (face, size))
Bryan Oakley