简体   繁体   中英

wxPython StaticText Widget Font

如何在wxPython StaticText小部件上设置字体?

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM