wxPython StaticText Widget Font

前端 未结 1 1375
暗喜
暗喜 2021-01-17 08:33

How do I set the font on a wxPython StaticText widget?

相关标签:
1条回答
  • use object.SetFont. For example (from wxpython in Action):

    text = wx.StaticText(panel, -1, 'my text', (20, 100))
    font = wx.Font(18, wx.DECORATIVE, wx.ITALIC, wx.NORMAL)
    text.SetFont(font)
    

    wx.Font has the following signature:

    wx.Font(pointSize, family, style, weight, underline=False, faceName="", encoding=wx.FONTENCODING_DEFAULT)
    

    family can be:

    wx.DECORATIVE, wx.DEFAULT,wx.MODERN, wx.ROMAN, wx.SCRIPT or wx.SWISS.

    style can be:

    wx.NORMAL, wx.SLANT or wx.ITALIC.

    weight can be:

    wx.NORMAL, wx.LIGHT, or wx.BOLD

    0 讨论(0)
提交回复
热议问题