== Using Fonts == Simple program that writes text to a panel. == Code Sample == {{{ #!python import wx class DrawPanel(wx.Panel): def __init__(self, parent): wx.Panel.__init__(self, parent) self.Bind(wx.EVT_PAINT, self.OnPaint) def OnPaint(self, event=None): dc = wx.PaintDC(self) dc.Clear() dc.SetFont(wx.Font(12, wx.MODERN, wx.NORMAL, wx.NORMAL)) dc.DrawText("Modern font Family", 50, 50) app = wx.App(0) frame = wx.Frame(None, title="Font Family") DrawPanel(frame) frame.Show() app.MainLoop() }}} === Comments === You can use operating system fonts, if you are not concerned about platform independence or you can also access the system fonts by using '''wxfontDialog'''. === Custom Fonts on Windows === To load custom fonts on Windows use the following recipe: {{{ #!python from ctypes import * import os import os.path gdi32= WinDLL("gdi32.dll") fonts = [font for font in os.listdir("fonts") if font.endswith("otf") or font.endswith("ttf")] for font in fonts: gdi32.AddFontResourceA(os.path.join("fonts",font)) }}} This will load all .otf and .ttf fonts in the "fonts" subdirectory of your project.